Created
October 18, 2010 20:23
-
-
Save fnordfish/632982 to your computer and use it in GitHub Desktop.
nginx vhost config for php using php-fpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
access_log /var/log/nginx/localhost.access.log; | |
root /var/www/MyAgaviApp/pub/; | |
## Default location | |
location / { | |
fastcgi_pass backend; | |
fastcgi_index index.php; | |
fastcgi_split_path_info ^(.+\.php)(.*)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
fastcgi_intercept_errors on; | |
fastcgi_ignore_client_abort off; | |
fastcgi_connect_timeout 60; | |
fastcgi_send_timeout 180; | |
fastcgi_read_timeout 180; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
} | |
## Disable viewing .htaccess & .htpassword | |
location ~ /\.ht { | |
deny all; | |
} | |
## Images and static content is treated different | |
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { | |
access_log off; | |
expires 30d; | |
} | |
## Agavi Rewriting | |
# drop the "location" part and keep the inner "if" if you want rewritten URLs only. | |
location ~ ^((?!index\.php).)*$ { | |
if (!-f $request_filename) { | |
rewrite ^/([^?]*)$ /index.php?/$1 last; | |
break; | |
} | |
} | |
} | |
upstream backend { | |
server 127.0.0.1:9000; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment