Skip to content

Instantly share code, notes, and snippets.

@guillaumepiot
Last active December 18, 2015 16:39
Show Gist options
  • Save guillaumepiot/5813443 to your computer and use it in GitHub Desktop.
Save guillaumepiot/5813443 to your computer and use it in GitHub Desktop.
NGINX - Default site vhost
# Redirect from www to nothing if not accepting domain name only
server {
server_name www.<domain-name>;
rewrite ^(.*) http://<domain-name>$1 permanent;
}
server {
listen 80;
server_name <domain-name>;
error_log /var/www/<mysitename>/logs/error.log;
root /var/www/<mysitename>/;
location /static/ {
autoindex off;
root /var/www/<mysitename>/<repo-name>/;
}
location /media/ {
autoindex off;
root /var/www/<mysitename>/<repo-name>/;
}
location / {
include uwsgi_params;
uwsgi_param SCRIPT_NAME "";
uwsgi_pass 127.0.0.1:<wsgi_port>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment