nginxでphpmyadmin, symfony1.4などを利用する際の設定ファイルをまとめました。nginx1.xとnginx0.xとでは多少設定ファイルが異なります。ご注意ください。
phpmyadmin:
location /phpmyadmin { alias /usr/share/phpmyadmin/; index index.php; } location ~ ^/phpmyadmin/.+\.php$ { root /usr/share/phpmyadmin/; rewrite /phpmyadmin/(.*\.php?) /$1 break; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name; }
symfony1.4 for nginx0.9x
location / { if (-f $request_filename) { expires max; break; } if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") { rewrite ^(.*) /index.php last; } } location /sf/ { root /usr/share/php/data/symfony/web; } 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; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/symfony1.4/web$script; fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_NAME $script; }
symfony1.4 for nginx1.x
location /sf/ { root /usr/share/php/data/symfony/web; } location / { root /var/www/symfony1.4/web/; index index.php; if (-f $request_filename) { expires max; break; } if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") { rewrite ^(.*) /index.php last; } } 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; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_NAME $script; fastcgi_param SCRIPT_FILENAME /var/www/symfony1.4/web$script; fastcgi_param PATH_INFO $path_info; }