欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

nginx+php目录配置,nginx虚拟目录配置(php-fpm+fastcgi)

程序员文章站 2024-02-21 15:14:58
...
server {

listen 80;

server_name www.test.net;

index index.html index.htm index.php;

root /www/www.test.net/public;

access_log /www/access_log/test_log;

location / {

if (!-e $request_filename){ rewrite (.*) /index.php last;}

}

location /uploads {

if (!-e $request_filename){ rewrite (.*) /uploads/index.php last;}

}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {

access_log off;

expires 30d;

}

location ~ .php$ {

root /www/www.test.net/public;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_script_name;

}

location ~ /\.ht {

deny all;

}

}

相关标签: nginx+php目录配置