Skip to content

Instantly share code, notes, and snippets.

@kimus
Last active April 4, 2016 13:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimus/bf0e1da81a1a129e46c0 to your computer and use it in GitHub Desktop.
Save kimus/bf0e1da81a1a129e46c0 to your computer and use it in GitHub Desktop.
Server Configurations

Server Configurations

NGINX

server {
  server_name .example.com;
  root /srv/example.com/htdocs;
}

php5-fpm

> sudo apt-get install php5-fpm
server {
  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
  }
}

fastcgi

> sudo apt-get install fcgiwrap
server {
  location /cgi-bin/ {
    root /srv/example.com/cgi-bin;
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

uWSGI

> sudo apt-get install uwsgi-plugin-python
server {
  location / {
    uwsgi_pass  127.0.0.1:3031;
    include uwsgi_params;
  }
}

Configuration file example (uwsgi.ini) for uWSGI:

[uwsgi]
socket = 127.0.0.1:3031
master = true
processes = 2
env = DJANGO_SETTINGS_MODULE=djangoapp.settings
module = django.core.handlers.wsgi:WSGIHandler()
home = /path/to/virtualenv
touch-reload = /path/to/reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment