2017-01-28 12 views
2

私はnginxphp7.0-fpmUbuntu 16.04サーバーの私のLaravel 5.4アプリを設定している中のnginxとphp7.0-FPMとLaravel 5.4のために、それは、502不正なゲートウェイは、Ubuntuの

502 Bad Gateway 

nginxのバーチャルホスト設定を提供します

server { 
    listen 80; ## listen for ipv4; this line is default and implied 
    #listen [::]:80 default ipv6only=on; ## listen for ipv6 

    root /var/www/html/laravel/public; 
    index index.php index.html; 

    # Make site accessible from http://localhost/ 
    server_name localhost; 

    location/{ 
     try_files $uri $uri/ /index.php?$query_string; 
    } 

    location ~ \.php$ { 
     try_files $uri /index.php =404; 
     include     fastcgi_params; 
     fastcgi_keep_conn on; 
     fastcgi_index   index.php; 
     fastcgi_split_path_info ^(.+\.php)(/.+)$; 
     fastcgi_param PATH_INFO $fastcgi_path_info; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     fastcgi_intercept_errors on; 
     fastcgi_pass unix:/var/run/php7.0-fpm.sock; 
    } 
} 

は、次のことをしようとしましたが、まだ動作していない、

はにfastcgi_pass unix:/var/run/php7.0-fpm.sock;を変更しました私は、

デフォルトのPHPで1行の更新
server { 
     listen 80; ## listen for ipv4; this line is default and implied 
     #listen [::]:80 default ipv6only=on; ## listen for ipv6 

     root /var/www/html/laravel/public; 
     index index.html index.htm index.php; 

     # Make site accessible from http://localhost/ 
     server_name localhost; 

     location/{ 
       try_files $uri $uri/ =404; 
     } 

     location ~ \.php$ { 
       include snippets/fastcgi-php.conf; 
       fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
     } 

     location ~ /\.ht { 
       deny all; 
     } 
} 

答えて

2

をこの設定を持つ唯一のメインルートにアクセスすることができます

service nginx restart 
service php7.0-fpm restart 

、各変更後に再起動サービス

try_files $uri $uri/ /index.php$is_args$args;try_files $uri $uri/ /index.php?$query_string;を変更

ベースの設定は、

server { 
     listen 80; ## listen for ipv4; this line is default and implied 
     #listen [::]:80 default ipv6only=on; ## listen for ipv6 

     root /var/www/html/laravel/public; 
     index index.html index.htm index.php; 

     # Make site accessible from http://localhost/ 
     server_name localhost; 

     location/{ 
       try_files $uri $uri/ /index.php?$query_string; 
     } 

     location ~ \.php$ { 
       include snippets/fastcgi-php.conf; 
       fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
     } 

     location ~ /\.ht { 
       deny all; 
     } 
} 

ここに変更しましたtry_files $uri $uri/ =404;からtry_files $uri $uri/ /index.php?$query_string;

関連する問題