您的位置:首页 > 编程语言 > PHP开发

Lnmp 支持thinkphp

2016-07-08 11:21 441 查看
ssh里执行:

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


再将虚拟主机配置文件里的location ~ ..(php|php5)?$ 替换为:location ~ ..php

再在include fcgi.conf; 下面添加一行include pathinfo.conf;

重启nginx

完整的虚拟主机配置文件如下:

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  thinkphp