Skip to content
Pavel Kucherbaev edited this page Nov 18, 2015 · 1 revision

userfull-things

NGINX settings for django project, which serves static and phpmyadmin:

# Gunicorn server
upstream crowdbox_production {
  server         crowdbox.me:8000;
}
#server {
# listen 80;
# server_name crowdbox.me;
# return 301 https://$server_name$request_uri;
#}
#server {
# listen 8001;
# server_name crowdbox.me;
# return 301 https://$server_name$request_uri;
#}
server {
  listen       80.240.134.163:443; #replace with your own ip address
  server_name  crowdbox.me;

  access_log  /var/log/nginx/crowdbox_access.log;

  ssl on;
  ssl_certificate /etc/nginx/ssl/ssl-bundle.crt;
  ssl_certificate_key /etc/nginx/ssl/dummy-key.pem;
  ssl_prefer_server_ciphers       on;


  location /static{
        alias /var/www/crowdbox.me/static/;
  }
  location /phpmyadmin {
        root   /usr/share/;           # Document root
        index index.php  index.html index.htm;
  }
  location ~ \.php$ {
        root           /usr/share/;   # Document root
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
  }
  # Check if a file exists at /var/www/domain/ for the incoming request.
  # If it doesn't proxy to Gunicorn/Django.
  try_files $uri @crowdbox_production;

  # Setup named location for Django requests and handle proxy details
  location @crowdbox_production {
    proxy_pass         http://crowdbox_production;
    proxy_redirect     default;
    proxy_set_header   Host             $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-Protocol ssl;
  }
}

create a link to settings in sites-enabled

rm /etc/nginx/sites-enabled/crowdcafe
ln -s /etc/nginx/sites-available/crowdcafe /etc/nginx/sites-enabled/crowdcafe

DJANGO project-folder conventions:

http://zacharyvoase.com/2010/02/03/django-project-conventions/

Manage git pull-request

Step 1: From your project repository, check out a new branch and test the changes.

git checkout -b sahanDissanayake-patch-2 gh-pages
git pull https://github.com/sahanDissanayake/social-feed.git patch-2

Step 2: Merge the changes and update on GitHub.

git checkout gh-pages
git merge --no-ff sahanDissanayake-patch-2
git push origin gh-pages

SSL

https://lincolnloop.com/django-best-practices/deployment/servers.html