server{
server_name tiger.com;
root /opt/projects/t.xxx.com/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
if ( !-e $REQUEST_FILENAME )
{
rewrite ^/(.*)$ /index.php?url=$1 last;
}
access_log /home/nginx/logs/t.com_access.log;
}
PHP项目在nginx中的配置
最新推荐文章于 2025-07-28 11:12:29 发布
本文详细解析了Nginx服务器的配置文件,包括server_name、root目录、index文件、location匹配规则、fastcgi参数设置、rewrite重写规则及access_log日志记录等内容,为读者提供了一个全面理解Nginx配置的视角。
970

被折叠的 条评论
为什么被折叠?



