As described by the problem statement, I am running openSUSE (leap 42.3). I have a node app running on localhost:3000
which I would like to publish it (make it available to people outside my network). I already have a domain and currently, the files are being served by apache2 on port 80. I have found tons of similar problems online and solutions for them, but none are specific to mine (I think it is because of the operating system). Can anyone give me step by step solution to what I must do?
The first solution I found told me to change the configuration file and this is what I have right now:
<VirtualHost *:80>
ServerName test.mytestsitebyrichard.com
ServerAlias *.test.mytestsitebyrichard.com
DocumentRoot /srv/www/htdocs
#ProxyRequests on <--currently commented but this is what online tutorials told me to do. However, it is crashing the apache2
#ProxyPass /cs/ http://localhost:3000/
</VirtualHost>
Do I need to enable anything? I have enabled the ProxyPass
and ProxyPassReverse
from the configuration menu. Any help would be appreciated. Thank you.
You can achieve this in Nginx with Reverse Proxy.
In your /etc/nginx/sites-enabled/
directory add a new configuration file (e.g. myapp.conf
) with following configuration:
server {
listen 80;
server_name yoururl.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}