skip to Main Content

My system is hosted by Amazon LighSail.
My application is running with Nodejs on the port 3000.
I installed my HTTPS certificate for my domain name with Let’s Encrypt.

Now I want to reach my nodejs application directly to my sub-domain.domain.com.
When I go to my domain name (sub-domain.domain.com), I’m directed to the bitnami home page.

So I have:

https://sub-domain.domain.com –> bitnami home page

IP-ADDRESS:3000 –> my nodejs application

I add a proxy to redirect all HTTP request to my port 3000 but with no sucess.

My proxy added in /etc/apache2/sites-enabled/000-default.conf :

< VirtualHost *:80 >

ServerAdmin webmaster@localhost

ServerName www.sub-domain.domain.com

ProxyPass / http://127.0.0.1:3000/

ProxyPassReverse / http://127.0.0.1:3000/

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined 

< / VirtualHost >

Someone has an idea to solve my problem or any clue?

2

Answers


  1. Chosen as BEST ANSWER

    Solved ! I had to add my proxy in this file: /opt/bitnami/apache2/conf/bitnami/bitnami.conf


  2. With SSL Cert the config should look more like this:

    <VirtualHost *:80>
    
            ServerName yoursite.com
            ServerAlias *yoursite.com
            ServerAdmin [email protected]
            DocumentRoot /var/www/yourSite
            LogLevel debug
    
            SSLEngine on
            SSLCertificateFile /path/to/lets/encrypt/cert
            SSLCertificateKeyFile /path/to/lets/encrypt/key
    
            SSLProxyEngine on
    
            ProxyPass "/" "http://127.0.0.1:3000/"
            ProxyPassReverse "/" "http://127.0.0.1:3000/"
    
            ErrorLog ${APACHE_LOG_DIR}/yourSite_error_https.log
            CustomLog ${APACHE_LOG_DIR}/yourSite_access_https.log combined
    
    
    </VirtualHost>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search