From nginus, 6 Years ago, written in Plain Text.
Embed
  1. server {
  2.         listen   80; ## listen for ipv4; this line is default and implied
  3.         listen   [::]:80 default ipv6only=on; ## listen for ipv6
  4.  
  5.         root /usr/html;
  6.         index index.php index.html index.htm;
  7.  
  8.         # Make site accessible from http://localhost/
  9.         server_name _;
  10.  
  11.         location / {
  12.                 # First attempt to serve request as file, then
  13.                 # as directory, then fall back to index.html
  14.                 try_files $uri $uri/ /index.html;
  15.                 # Uncomment to enable naxsi on this location
  16.                 # include /etc/nginx/naxsi.rules
  17.         }
  18.  
  19.         location /doc/ {
  20.                 alias /usr/share/doc/;
  21.                 autoindex on;
  22.                 allow 127.0.0.1;
  23.                 deny all;
  24.         }
  25.  
  26.         # Only for nginx-naxsi : process denied requests
  27.         #location /RequestDenied {
  28.                 # For example, return an error code
  29.                 #return 418;
  30.         #}
  31.  
  32.         #error_page 404 /404.html;
  33.  
  34.         # redirect server error pages to the static page /50x.html
  35.         #
  36.         error_page 500 502 503 504 /50x.html;
  37.         location = /50x.html {
  38.                 root /usr/html;
  39.         }
  40.  
  41.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  42.         #
  43.         location ~ \.php$ {
  44.                 try_files $uri =404;
  45.                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
  46.                 fastcgi_pass 127.0.0.1:9000;
  47.                 fastcgi_index index.php;
  48.                 include fastcgi_params;
  49.         }
  50.  
  51.         # deny access to .htaccess files, if Apache's document root
  52.         # concurs with nginx's one
  53.         #
  54.         location ~ /\.ht {
  55.                 deny all;
  56.         }
  57. }