首頁  >  問答  >  主體

nginx 部署thinkphp3.2.3遇到的問題

環境:阿里雲ubuntu 14.04 nginx 1.8.0 php 5.5.9, 有虛擬主機,已經安裝多個應用程式

安裝weiphp的時候,查了很多,得知nginx不支援phpinfo,rewrite,,,也不太懂。然後安裝的時候可以打開安裝頁面,但點擊同意協議的時候,跳轉路徑不正常:
http://xx.cn.php/?s=/install/step1.html(但是如果手動改成http://xx.cn/install.php?s=/install/step1.html的話就可以看到檢測環境頁面,只不過下一步也失敗)
情況就是這樣,求教...大概設定了一下本應用程式的設定檔如下:

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 天前489

全部回覆(3)我來回復

  • 天蓬老师

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

    給你一份我的 配置,也是1.8的nginx

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

    這樣就可以了,不用寫一大堆

    回覆
    0
  • 巴扎黑

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

    ubuntu下搭建thinkphp開發環境:

    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

    回覆
    0
  • 天蓬老师

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

    把tp的url模式改成rewrite就行了

    回覆
    0
  • 取消回覆