Last active
December 4, 2020 17:27
-
-
Save Amar-Chaudhari/0de5bf8d209614c59200043356f5cfa9 to your computer and use it in GitHub Desktop.
Revisions
-
Amar-Chaudhari revised this gist
Jul 6, 2016 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Domain : xyz.com server { listen 80; server_name xyz.com; access_log /var/webapps/xyz.com/logs/access.log; error_log /var/webapps/xyz.com/logs/error.log; @@ -38,16 +38,17 @@ server { # serve static content location /static/ { # Update correct static folder path root /var/webapps/xyz/main/; } location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # use the sock created in above gunicorn file proxy_pass http://unix:/var/webapps/run/SOMENAME.sock; } } ``` -
Amar-Chaudhari created this gist
Jul 6, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ # Nginx + Gunicorn + Django ## Gunicorn configuration Filename : /etc/systemd/system/gunicorn.service ``` [Unit] Description=gunicorn daemon After=network.target [Service] # Update all paths below # Setting provided are for reference only ! User=webapp Group=www WorkingDirectory=/var/webapps/sbprod/django_project_dir ExecStart=/var/webapps/virtual_sample_env/bin/gunicorn --workers 2 --bind unix:/var/webapps/run/SOMENAME.sock Django_project_name.wsgi:application [Install] WantedBy=multi-user.target ``` ## Nginx configuration Domain : xyz.com ``` server { listen 80; server_name xyz.com; access_log /var/webapps/xyz.com/logs/access.log; error_log /var/webapps/xyz.com/logs/error.log; root /var/webapps/xyz.com/public_html/; index index.php index.html index.htm; location = /favicon.ico { access_log off; log_not_found off; } # serve static content location /static/ { # Update correct static folder path root /var/webapps/sbprod/xyz/main/; } location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://unix:/var/webapps/run/SOMENAME.sock; #Use the sock created in above gunicorn file } } ```