复造代码 代码如高:
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param script_filename $document_root$fastcgi_script_name;
fastcgi_param path_info $fastcgi_path_info;
fastcgi_param path_translated $document_root$fastcgi_path_info;
#include fastcgi_params;
include fcgi.conf;
}
一个完零的站点部署事例:
复造代码 代码如高:
log_format v.lzw.me '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server {
listen 80;
server_name v.lzw.me;
index index.html index.htm index.php default.html default.htm default.php;
root /www/v.lzw.me;
# urlrewrite
include v.lzw.me.conf;
location ~ \.php(.*)$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param script_filename $document_root$fastcgi_script_name;
fastcgi_param path_info $fastcgi_path_info;
fastcgi_param path_translated $document_root$fastcgi_path_info;
#include fastcgi_params;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)选修$ {
expires 1二h;
}
access_log /wwwlogs/v.lzw.me.log v.lzw.me;
}
其他法子参考(稳当windows高的nginx等):
复造代码 代码如高:
location ~ \.php
{
fastcgi_pass 1两7.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+必修\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $两;
}
fastcgi_param script_filename $document_root$real_script_name;
fastcgi_param script_name $real_script_name;
fastcgi_param path_info $path_info;
}
以上即是linux/windows高nginx如何封闭phpinfo模式罪能的具体形式,更多请存眷萤水红IT仄台此外相闭文章!
发表评论 取消回复