番外篇:ubuntu nginx thinkphp

来源:互联网 发布:mac 删除输入法记忆 编辑:程序博客网 时间:2024/05/01 14:10

之前一直在Apache服务器上使用thinkphp,这几天把项目放到了nginx服务器上之后,发现thinkphp的pathinfo出现了问题,需要对vhost(/etc/nginx/site-enable/目录下的文件)文件进行修改,这里贴出我自己的配置文件,主要修改了location ~ \.php${}之间的代码

server {        listen 9080 default_server;        listen [::]:9080 default_server;        root /var/www/html;        index index.html index.htm index.nginx-debian.html index.php;        server_name _;        location / {                # First attempt to serve request as file, then                # as directory, then fall back to displaying a 404.                try_files $uri $uri/ =404;        }        location ~ \.php/?.*$ {                include snippets/fastcgi-php.conf;                fastcgi_pass unix:/run/php/php7.0-fpm.sock;                include        fastcgi.conf;                set $fastcgi_script_name2 $fastcgi_script_name;                if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {                        set $fastcgi_script_name2 $1;                        set $path_info $2;                }                fastcgi_param   PATH_INFO $path_info;                fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;                fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;        }}                                                                                                                                                                                                
0 0
原创粉丝点击