Skip to content

Instantly share code, notes, and snippets.

@jmikola
Forked from jself/Nginx Conf
Created September 19, 2010 20:45
Show Gist options
  • Save jmikola/587104 to your computer and use it in GitHub Desktop.
Save jmikola/587104 to your computer and use it in GitHub Desktop.
jself's nginx config
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts
server {
listen 80 default;
server_name domain.com;
if ($host = 'domain.com') {
rewrite ^ http://www.domain.com$uri permanent;
}
access_log /var/log/nginx/domain.access.log;
error_log /var/log/nginx/domain.error.log;
client_max_body_size 5M;
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
#location / {
# root /var/www/nginx-default;
# index index.html index.htm;
#}
#location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) {
# access_log off;
# expires 30d;
#}
location /media {
root /home/projects/quotes_env/quotes;
}
location /admin-media {
alias /home/projects/quotes_env/lib/python2.6/site-packages/django/contrib/admin/media;
}
location /favicon.ico {
alias /home/projects/quotes_env/quotes/media/favicon.ico;
}
location /robots.txt {
alias /var/www/robots.txt;
}
location / {
# host and port to fastcgi server
fastcgi_pass 127.0.0.1:3035;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/nginx-default;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}
# 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 /scripts$fastcgi_script_name;
#includefastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#deny all;
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment