軍兄lnmpワンタッチインストールパッケージnginxはpathinfo構成をサポート
1552 ワード
sshで実行:
プロファイルに行を追加
include pathinfo.conf;
完全に以下の通りです.
cat > /usr/local/nginx/conf/pathinfo.conf << 'EOF'
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
EOF
プロファイルに行を追加
include pathinfo.conf;
完全に以下の通りです.
server
{
listen 80;
server_name www.lnmp.org;
index index.html index.htm index.php;
root /home/wwwroot/lnmp;
location ~ .*\.php
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
include pathinfo.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/lnmp.log lnmp;
}