Skip to content

Instantly share code, notes, and snippets.

@simonklee
Created June 22, 2010 06:41
Show Gist options
  • Save simonklee/448093 to your computer and use it in GitHub Desktop.
Save simonklee/448093 to your computer and use it in GitHub Desktop.
nginx uwsgi django config
# FILE: /etc/init/uwsgi_[project].conf
description "uWSGI server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec uwsgi -s /tmp/uwsgi.sock -p 4 -M -t 20 -C -L \
-x [projectpath]/uwsgi.conf \
-H [projectpath]/ve \
--pythonpath [projectpath-parent] \
--pidfile [projectpath]/log/pidfile.txt
# FILE: <projectpath>/uwsgi.conf
<uwsgi>
<pythonpath>[projectpath]/ve/</pythonpath>
<pythonpath>[projectpath]</pythonpath>
<pythonpath>[projectpath-parent]</pythonpath>
<app mountpoint="/">
<script>[project].django_wsgi</script>
</app>
</uwsgi>
# FILE: /etc/init/nginx.conf
description "Nginx HTTP server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/sbin/nginx
# FILE: /etc/nginx.conf
user www-data;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5;
gzip off;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css
application/x-javascript text/xml
application/xml application/xml+rss
text/javascript;
server {
listen [your-ip]:80;
server_name [domain];
location / {
uwsgi_pass /tmp/uwsgi.sock;
include uwsgi_params;
}
location /media {
alias [projectpath]/media;
}
}
server {
listen [your-ip]:80;
server_name phpmyadmin.[domain];
location / {
root /usr/share/phpmyadmin;
index index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
include fastcgi_params;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment