2017-07-12 6 views
0

私はこのnginx設定を持っています。Nginxで実行されているlaravelアプリケーションで404を取得します

server { 
     listen 80; 
     listen [::]:80; 

     server_name apps.myapp.com; 

     root /var/www/apps.myapp.com/public; 
     index index.php; 

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

私はこのルートを持っている:

Route::get('/lead', '[email protected]'); 

私はhttp://apps.myapp.com/leadにアクセスすると、私はあなたがほかにあった場合、ファイル構成のいずれかのエラーをチェックするためにnginx -tを実行することができます404

+0

'場所/ { 場合{ 書き換え^ /にあなたの場所を変更しようとする/ $/$ 1リダイレクト(-e $ REQUEST_FILENAME!)(*。); } if(!-e $ request_filename){ ^(。*)$ /index.phpを書き換えます。 } } ' –

答えて

0

これは私が私のLaravelアプリケーションに使用する設定です。

location/{ 
       # First attempt to serve request as file, then 
       # as directory, then fall back to displaying a 404. 
       try_files $uri $uri/ /index.php?$query_string; 
} 

location ~ \.php$ { 
       try_files $uri $uri/ /index.php?$query_string; 
       include snippets/fastcgi-php.conf; 
       fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include fastcgi_params; 
} 
関連する問題