Skip to content

Instantly share code, notes, and snippets.

@zernel
Forked from ouyangzhiping/copsy.org.config
Created October 22, 2012 08:57
Show Gist options
  • Save zernel/3930464 to your computer and use it in GitHub Desktop.
Save zernel/3930464 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