Lnmp 支持thinkphp

来源:互联网 发布:axentwear淘宝 编辑:程序博客网 时间:2024/05/22 14:17

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;        }
0 0