0

I have created a node program that it's working on http://example.com:3000/node/index.html and I want to "hide" the port (3000).

I have been reading that I need the a proxy server so I configured apache in different ways but I can't reach what I want.

For example I have used:

<VirtualHost myip:8443 myip:8080>     
ServerName example.com    
ServerAlias www.example.com     
DocumentRoot /home/www/  
ProxyPreserveHost On 
ProxyPass /node http://example.com:3000/ 
ProxyPassReverse /node http://example.com:3000/   
</VirtualHost>

Please help!!

0

As I get from your question, you are quite new to this and I will take advantage of the opportunity to push you towards nginx instead of apache as the former is just nicer to work with when dealing with non-php websites. Additionally, I can just copy-paste you the configuration from my own server. Drop the following into /etc/nginx/sites-enabled/my-site.conf:

server {
        listen 80;
        listen [::]:80;
        server_name example.com;
        location / {
            proxy_pass http://localhost:3000;
        }
}
  • I have Cpanel, so I configured the engintron (nginx) but it did not work... – Sebastian Apr 9 '18 at 2:31
0

Try this Apache configuration:

<VirtualHost myip:80>     
     ServerName example.com    
     ServerAlias www.example.com     
     ProxyPreserveHost On 
     ProxyPass /node http://example.com:3000/node 
     ProxyPassReverse /node http://example.com:3000/node
</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.