Advertisement
Guest User

nginx configuration

a guest
Feb 21st, 2012
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. user nginx nginx;
  3. worker_processes  1;
  4.  
  5. #error_log  logs/error.log;
  6. #error_log  logs/error.log  notice;
  7. #error_log  logs/error.log  info;
  8.  
  9. #pid        logs/nginx.pid;
  10.  
  11.  
  12. events {
  13.     worker_connections  1024;
  14. }
  15.  
  16.  
  17. http {
  18.     include       mime.types;
  19.     default_type  application/octet-stream;
  20.  
  21.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  22.     #                  '$status $body_bytes_sent "$http_referer" '
  23.     #                  '"$http_user_agent" "$http_x_forwarded_for"';
  24.  
  25.     #access_log  logs/access.log  main;
  26.  
  27.     sendfile        on;
  28.     #tcp_nopush     on;
  29.  
  30.     #keepalive_timeout  0;
  31.     keepalive_timeout  65;
  32.  
  33.     gzip  on;
  34.  
  35.     server {
  36.         listen       80;
  37.         server_name  localhost;
  38.  
  39.         #charset koi8-r;
  40.  
  41.         access_log  /var/log/nginx/logs/host.access.log;
  42.         error_log /var/log/nginx/logs/host.error.log;
  43.  
  44.         location / {
  45.             root   html;
  46.             index  index.html index.htm;
  47.         }
  48.  
  49.  
  50.  
  51.         location /media {
  52.             alias /usr/share/nginx/http/projects/media;
  53.         }
  54.         location /static {
  55.             alias /usr/share/nginx/http/projects/static;
  56.         }
  57.         location /static/admin {
  58.             alias /usr/lib/python2.7/site-packages/django/contrib/admin/media;
  59.         }
  60.         location /templates {
  61.             alias /usr/share/nginx/http/projects/templates;
  62.         }
  63.         location /mystatic {
  64.             alias /usr/share/nginx/http/projects/mystatic;
  65.         }
  66.  
  67.         location /blog {
  68.             fastcgi_pass 127.0.0.1:8080;
  69.             fastcgi_param PATH_INFO $fastcgi_script_name;
  70.             fastcgi_param REQUEST_METHOD $request_method;
  71.             fastcgi_param QUERY_STRING $query_string;
  72.             fastcgi_param CONTENT_TYPE $content_type;
  73.             fastcgi_param CONTENT_LENGTH $content_length;
  74.             fastcgi_pass_header Authorization;
  75.             fastcgi_intercept_errors off;
  76.             fastcgi_param REMOTE_ADDR $remote_addr;
  77.         }
  78.  
  79.         #error_page  404              /404.html;
  80.  
  81.         # redirect server error pages to the static page /50x.html
  82.         #
  83.         error_page   500 502 503 504  /50x.html;
  84.         location = /50x.html {
  85.             root   html;
  86.         }
  87.  
  88.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  89.         #
  90.         #location ~ \.php$ {
  91.         #    proxy_pass   http://127.0.0.1;
  92.         #}
  93.  
  94.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  95.         #
  96.         #location ~ \.php$ {
  97.         #    root           html;
  98.         #    fastcgi_pass   127.0.0.1:9000;
  99.         #    fastcgi_index  index.php;
  100.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
  101.         #    include        fastcgi_params;
  102.         #}
  103.  
  104.         # deny access to .htaccess files, if Apache's document root
  105.         # concurs with nginx's one
  106.         #
  107.         #location ~ /\.ht {
  108.         #    deny  all;
  109.         #}
  110.     }
  111.  
  112.  
  113.     # another virtual host using mix of IP-, name-, and port-based configuration
  114.     #
  115.     #server {
  116.     #    listen       8000;
  117.     #    listen       somename:8080;
  118.     #    server_name  somename  alias  another.alias;
  119.  
  120.     #    location / {
  121.     #        root   html;
  122.     #        index  index.html index.htm;
  123.     #    }
  124.     #}
  125.  
  126.  
  127.     # HTTPS server
  128.     #
  129.     #server {
  130.     #    listen       443;
  131.     #    server_name  localhost;
  132.  
  133.     #    ssl                  on;
  134.     #    ssl_certificate      cert.pem;
  135.     #    ssl_certificate_key  cert.key;
  136.  
  137.     #    ssl_session_timeout  5m;
  138.  
  139.     #    ssl_protocols  SSLv2 SSLv3 TLSv1;
  140.     #    ssl_ciphers  HIGH:!aNULL:!MD5;
  141.     #    ssl_prefer_server_ciphers   on;
  142.  
  143.     #    location / {
  144.     #        root   html;
  145.     #        index  index.html index.htm;
  146.     #    }
  147.     #}
  148.  
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement