Created
April 11, 2012 14:06
-
-
Save rochacbruno/2359513 to your computer and use it in GitHub Desktop.
web2py + NGINX + UWSGI
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 characters
ln -s /etc/nginx/sites-available/sitename /etc/nginx/sites-enabled/sitename | |
ln -s /etc/uwsgi-python/apps-available/sitename.xml /etc/uwsgi-python/apps-enabled/sitename.xml | |
# note that the name of UWSGI directory changed in new ubuntu versions. |
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 characters
server { | |
server_name web2pyslices.com web2pystore.com www.web2pystore.com; | |
rewrite ^/(.*) http://www.web2pyslices.com/$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name www.web2pyslices.com admin.web2pyslices.com old.web2pyslices.com; | |
access_log /home/www-data/logs/access_web2pyslices.log; | |
error_log /home/www-data/logs/error_web2pyslices.log; | |
location ~* /(\w+)/static/ { | |
root /home/www-data/web2pyslices/applications/; | |
} | |
location / { | |
uwsgi_pass 127.0.0.1:9007; | |
include uwsgi_params; | |
} | |
} | |
server { | |
listen 443; | |
server_name web2pyslices.com www.web2pyslices.com admin.web2pyslices.com; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/web2py.crt; | |
ssl_certificate_key /etc/nginx/ssl/web2py.key; | |
location / { | |
uwsgi_pass 127.0.0.1:9007; | |
include uwsgi_params; | |
uwsgi_param UWSGI_SCHEME $scheme; | |
} | |
} |
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 characters
<uwsgi> | |
<socket>127.0.0.1:9007</socket> | |
<pythonpath>/home/www-data/web2pyslices/</pythonpath> | |
<app mountpoint="/"> | |
<script>wsgihandler</script> | |
</app> | |
</uwsgi> |
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 characters
user www-data; | |
worker_processes 4; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
# multi_accept on; | |
} | |
http { | |
## | |
# Basic Settings | |
## | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
# server_tokens off; | |
# server_names_hash_bucket_size 64; | |
# server_name_in_redirect off; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
## | |
# Logging Settings | |
## | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
## | |
# Gzip Settings | |
## | |
gzip on; | |
gzip_disable "msie6"; | |
# gzip_vary on; | |
gzip_proxied any; | |
gzip_comp_level 2; | |
# gzip_buffers 16 8k; | |
# gzip_http_version 1.1; | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
## | |
# Virtual Host Configs | |
## | |
include /etc/nginx/conf.d/*.conf; | |
include /etc/nginx/sites-enabled/*; | |
} | |
#mail { | |
# # See sample authentication script at: | |
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript | |
# | |
# # auth_http localhost/auth.php; | |
# # pop3_capabilities "TOP" "USER"; | |
# # imap_capabilities "IMAP4rev1" "UIDPLUS"; | |
# | |
# server { | |
# listen localhost:110; | |
# protocol pop3; | |
# proxy on; | |
# } | |
# | |
# server { | |
# listen localhost:143; | |
# protocol imap; | |
# proxy on; | |
# } | |
#} |
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 characters
uwsgi_param QUERY_STRING $query_string; | |
uwsgi_param REQUEST_METHOD $request_method; | |
uwsgi_param CONTENT_TYPE $content_type; | |
uwsgi_param CONTENT_LENGTH $content_length; | |
uwsgi_param REQUEST_URI $request_uri; | |
uwsgi_param PATH_INFO $document_uri; | |
uwsgi_param DOCUMENT_ROOT $document_root; | |
uwsgi_param SERVER_PROTOCOL $server_protocol; | |
uwsgi_param REMOTE_ADDR $remote_addr; | |
uwsgi_param REMOTE_PORT $remote_port; | |
uwsgi_param SERVER_PORT $server_port; | |
uwsgi_param SERVER_NAME $server_name; | |
uwsgi_param SERVER_SOFTWARE nginx/$nginx_version; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment