example ngnix conf file

Linux -- Posted on Dec. 6, 2019

example nginx conf file

              
                server {
    listen 80;
    server_name myproject.com;
    access_log /path/to/nginx-access.log;
    error_log /path/to/nginx-error.log debug;
    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /path/to/public/static;
    }
    location /media/ {
        root /patgh/to/public/media;
    }

    location / {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://unix:/path/to/project.sock;
    }

    location /ws/ {
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_pass http://unix:/path/to/project_asgi.sock;
    }
}
                  
   
            

Related Posts