搜尋

首頁  >  問答  >  主體

Bitnami中的Nginx伺服器如何設定Laravel專案?總是報502 Bad Gateway

參考網路上的好多設定教程,都失敗了,報502錯誤。

目前我的設定是這樣的:
/opt/bksite/nginx/conf/bitnami/bitnami.conf檔案

     server {                                                                                           
         listen       80;                                                                               
         server_name  localhost;                                                                        
                                                                                                        
         proxy_buffer_size 128k;                                                                        
         proxy_buffers 8 256k;                                                                          
         proxy_busy_buffers_size 256k;                                                                  
                                                                                                        
         set $root_path '/home/paiyang-admin/public/';                                                  
         root $root_path;                                                                               
                                                                                                        
         location / {                                                                                   
             index  index.php index.html index.htm;                                                     
             try_files $uri $uri/ /index.php;                                                           
         }                                                                                              
                                                                                                        
         include "/opt/bksite/nginx/conf/bitnami/phpfastcgi.conf";                                      
                                                                                                        
         include "/opt/bksite/nginx/conf/bitnami/bitnami-apps-prefix.conf";                             
     }       

/opt/bksite/nginx/conf/bitnami/phpfastcgi.conf檔案如下

 location ~ \.php$ {                                                                                    
     fastcgi_split_path_info ^(.+\.php)(/.+)$;                                                          
     fastcgi_read_timeout 300;                                                                          
     fastcgi_pass   unix:/opt/bksite/php/var/run/www.sock;                                              
                                                                                                        
     fastcgi_index  index.php;                                                                          
     fastcgi_param  SCRIPT_FILENAME $request_filename;                                                  
     include        fastcgi_params;                                                                     
 }

求幫助。

淡淡烟草味淡淡烟草味2757 天前604

全部回覆(2)我來回復

  • 世界只因有你

    世界只因有你2017-05-16 16:49:30

    嘗試這樣配置

        location / {
            try_files $uri /index.php$is_args$args;
        }
        
        location ~ ^/index\.php(/|$) {
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT $realpath_root;
        }

    回覆
    0
  • 阿神

    阿神2017-05-16 16:49:30

    errorlog找具體的原因, 我就是這樣解決的

    回覆
    0
  • 取消回覆