Notes tagged with "Nginx"

Web Application Setup - Nginx Set Up

NGINX SET UP

  1. Create your apps nginx configuration

    ... touch /var/www/appname/config/nginx-appname.cfg
    
  2. The content of your nginx-appname.cfg files should look like this:

    upstream appname {
        server unix:/var/run/uwsgi/appname.socket;
    }
    
    server {
    
        listen 80;
        server_name SERVER_IP SERVER_DOMAIN;
    
        location = /favicon.ico { access_log off; log_not_found off; }
    
        location /static/ {
            root /var/www/appname/;
        }
    
        location / {
            uwsgi_pass      appname;
            include         /etc/nginx/uwsgi_params;
        }
    
    }
    
  3. Link your nginx config file to nginx’ site config directory:

    ... cd /etc/nginx/sites-enabled
    ... ln -s /var/www/appname/config/appname-nginx.cfg appname
    
  4. You can check your nginx config by running the following: