Created at

Updated at

Category: Coding

Author: Soo


How to install NGINX and configure

What Is Nginx? A Basic Look at What It Is and How It Works

On terminal, run

  sudo apt install nginx

  sudo nano /etc/nginx/sites-available/default

Add the following to the location part of the server block

    server_name yourdomain.com www.yourdomain.com;

    location / {
        proxy_pass http://localhost:5000; #whatever port your app runs on
        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;
    }

Check NGINX config

  sudo nginx -t

Restart NGINX

  sudo service nginx restart

Add Comment


Comments


;