Problems encountered when nginx deploys thinkphp3.2.3
高洛峰
高洛峰 2017-05-16 17:18:32
0
3
518

Environment: Alibaba Cloud ubuntu 14.04 nginx 1.8.0 php 5.5.9, with virtual host and multiple applications installed

When I installed weiphp, I checked a lot and learned that nginx does not support phpinfo, rewrite,, and I didn’t quite understand. Then you can open the installation page during installation, but when you click to agree to the agreement, the jump path is abnormal:
http://xx.cn.php/?s=/install/step1.html (but if you change it manually http://xx.cn/install.php?s=/install/step1.html, you can see the detection environment page, but the next step also fails)
This is the situation, please give me some advice... Probably set it up The configuration file of this application is as follows:

server {

    listen       80;
    server_name xx.cn  www.xx.cn;
    root /var/www/xx/html/;
    index  index.php index.html index.htm;
    access_log /var/www/xx/logs/access.log;
    error_log /var/www/xx/logs/error.log;

    location / {
         try_files $uri $uri/ /index.php;
    }
    location ~ \.php$ {
        include fastcgi_params;
        set $real_script_name $fastcgi_script_name;

        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
            set $real_script_name ;
            set $path_info ;
            }
        fastcgi_param  SCRIPT_FILENAME /var/www/xx/html$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_read_timeout 240;

    }

}

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Peter_Zhu

Give you a copy of my configuration, which is also nginx 1.8

location / {
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=  last;
   break;
    }
 }

That’s it, no need to write a lot

巴扎黑

Build thinkphp development environment under ubuntu:

1.sudo apt-get install php5
2.sudo apt-get install nginx
3.sudo apt-get install mysql

配置修改 /etc/nginx/sites-enable/default 取消index.php 注释即可 linux用的 php-fpm
Peter_Zhu

Just change the url mode of TP to rewrite

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template