Skip to content

Instantly share code, notes, and snippets.

@ouyangzhiping
Created September 6, 2011 09:09
Show Gist options
  • Save ouyangzhiping/1197058 to your computer and use it in GitHub Desktop.
Save ouyangzhiping/1197058 to your computer and use it in GitHub Desktop.
nginx配置php站点示范
server {
server_name localhost www.copsy.org copsy.org;
access_log /srv/www/copsy.org/logs/access.log;
error_log /srv/www/copsy.org/logs/error.log;
root /srv/www/copsy.org/public_html;
location / {
index index.html index.htm index.php;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/copsy.org/public_html$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment