Home  >  Q&A  >  body text

Problems encountered when nginx deploys thinkphp3.2.3

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;

    }

}

高洛峰高洛峰2713 days ago492

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 17:20:32

    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

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-16 17:20:32

    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

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-16 17:20:32

    Just change the url mode of TP to rewrite

    reply
    0
  • Cancelreply