#在虚拟主机最前面加上如下即可,记住一定要以它开头(不然不生效)。如下,返回值404,可以改403等。
server {
server_name _; #default
return 404;
}
server
{
listen 80;
server_name .test.com; #(域名前加点,不然可能访问不了)
index main.php index.php;
root /var/htdocs/www/test;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
log_format testlogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /var/htdocs/logs/testlogs.log testlogs;
}
阅读(554) | 评论(0) | 转发(0) |