How to configure Laravel project with Nginx server in Bitnami? Always reports 502 Bad Gateway
淡淡烟草味
淡淡烟草味 2017-05-16 16:47:30
0
2
601

Refer to many configuration tutorials on the Internet, but they all failed and reported a 502 error.

My current configuration is like this:
/opt/bksite/nginx/conf/bitnami/bitnami.confFile

     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.confThe file is as follows

 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;                                                                     
 }

please help.

淡淡烟草味
淡淡烟草味

reply all(2)
世界只因有你

Try configuring like this

    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;
    }
阿神

Look for the specific reason in errorlog, this is how I solved it

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