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!!

2

2 Answers 2

1

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>
1
  • Thanks worked like charm Aug 25, 2021 at 17:56
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;
        }
}
1
  • I have Cpanel, so I configured the engintron (nginx) but it did not work...
    – Sebastian
    Apr 9, 2018 at 2:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .