Server { # Replace this port with the right one for your requirements Listen 80; # cocould also be 1.2.3.4: 80 # Multiple hostnames seperated by spaces. Replace these as well. Server_name www.111cn.net *. Your domain name. com; # Alternately :_* Root/PATH/TO/WEBROOT/$ host; Error_page 404 http://yourdomain.com/errors/404.html; Access_log logs/yourdomain.com. access. log; Location /{ Root/PATH/TO/WEBROOT/$ host /; Index. php; } # Serve static files directly Location ~ * ^. +. (Jpg | jpeg | gif | css | png | js | ico | html) $ { Access_log off; Expires 30d; } Location ~ . Php $ { # By all means use a different server for the fcgi processes if you need Fastcgi_pass 127.0.0.1: YOURFCGIPORTHERE; Fastcgi_index index. php; Fastcgi_param SCRIPT_FILENAME/PATH/TO/WEBROOT/$ host/$ fastcgi_script_name; Fastcgi_param QUERY_STRING $ query_string; Fastcgi_param REQUEST_METHOD $ request_method; Fastcgi_param CONTENT_TYPE $ content_type; Fastcgi_param CONTENT_LENGTH $ content_length; Fastcgi_param SCRIPT_NAME $ fastcgi_script_name; Fastcgi_param REQUEST_URI $ request_uri; Fastcgi_param DOCUMENT_URI $ document_uri; Fastcgi_param DOCUMENT_ROOT $ document_root; Fastcgi_param SERVER_PROTOCOL $ server_protocol; Fastcgi_param REMOTE_ADDR $ remote_addr; Fastcgi_param REMOTE_PORT $ remote_port; Fastcgi_param SERVER_ADDR $ server_addr; Fastcgi_param SERVER_PORT $ server_port; Fastcgi_param SERVER_NAME $ server_name; Fastcgi_intercept_errors on; } Location ~ /. Ht { Deny all; } } |