Created
September 6, 2011 09:09
-
-
Save ouyangzhiping/1197058 to your computer and use it in GitHub Desktop.
nginx配置php站点示范
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 { | |
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