Skip to content

Instantly share code, notes, and snippets.

@jacobian
Created September 26, 2011 23:11
Show Gist options
  • Save jacobian/1243704 to your computer and use it in GitHub Desktop.
Save jacobian/1243704 to your computer and use it in GitHub Desktop.
# Nginx conf (/etc/nginx/nginx.conf).
user www-data;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
worker_processes 4;
events {
worker_connections 100;
}
http {
include /etc/nginx/mime.types;
server_tokens off;
server {
listen 80;
listen 443;
server_name .jacobian.org;
# Redirect http to https
if ($scheme = "http") {
rewrite ^ https://$host$request_uri? permanent;
}
location /media {
alias /home/web/jacobian.org/jacobian/media;
}
location / {
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;
proxy_pass http://127.0.0.1:8000;
}
}
# fallback for unknown names
server {
listen 80 default;
server_name _;
return 444;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment