-1

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.

Note please refer to the screenshots below: enter image description here enter image description here enter image description here

Mr. T
  • 356
  • 3
  • 17
  • what is the url you are trying to access and what error do you get in logs – Satya Dec 15 '18 at 04:01
  • this is the URL I am trying to access (it is listed under the server name on the code snippet I have provided): `test.mytestsitebyrichard.com`. Not the real one of course. Just trying to maintain anonymity. The main error I get is a huge log of my apache crashing whenever I try to restart it. – Mr. T Dec 15 '18 at 04:13
  • How about deployment. So you mean to tell me when you develop something, you never run into deployment issues? – Mr. T Dec 15 '18 at 15:19

1 Answers1

0

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;
    }   
}
Mostafiz Rahman
  • 8,169
  • 7
  • 57
  • 74