Custom Search

Friday, April 26, 2019

How to Setup Nginx as a Reverse Proxy in front of your Node.js Ionic application

1)
sudo vim /etc/nginx/sites-available/myapp

server {
    listen 80;

    server_name exmaple;

    location / {
        proxy_pass http://127.0.0.1:8100;
        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;
    }
}

2)
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/myapp

3)
sudo service nginx configtest

sudo netstat -tuplen

sudo systemctl  restart nginx
or
sudo systemctl  reload nginx

sudo netstat -tuplen

4)
ionic serve
serve ionic app in port 8100

5)
http://127.0.0.1

No comments:

Post a Comment