Difference between revisions of "Nginx"
From Alessandro's Wiki
(Created page with " == Configuration == *; server { listen 80; server_name thedomain.com; access_log logs/access.log; error_log logs/error.log; root /home/swin/oaih/dev/public; i...") |
|||
Line 3: | Line 3: | ||
== Configuration == | == Configuration == | ||
*; server { | *; server { } | ||
listen 80; | listen 80; | ||
Line 14: | Line 14: | ||
index index.php index.html index.htm; | index index.php index.html index.htm; | ||
*; location { } | |||
location = /favicon.ico { | |||
log_not_found off; | |||
access_log off; | |||
} | |||
=== FastCGI === | === FastCGI === | ||
Revision as of 14:28, 1 October 2012
Configuration
- server { }
listen 80; server_name thedomain.com;
access_log logs/access.log; error_log logs/error.log;
root /home/swin/oaih/dev/public; index index.php index.html index.htm;
- location { }
location = /favicon.ico { log_not_found off; access_log off; }
FastCGI
location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~ .php($|/) { set $script $uri; set $path_info ""; if ($uri ~ "^(.+.php)(/.+)") { set $script $1; set $path_info $2; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$script; fastcgi_param SCRIPT_NAME $script; fastcgi_param PATH_INFO $path_info; }
Rewrite rules
- rewriting every non existent file to index.php
location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } }