2017-10-16 30 views
0

NginxとLaravelで新しいLEMPサーバーをセットアップしました。すべての正しいセットアップと2つの新しいデフォルトのラーベールプロジェクトは素晴らしい実行します。今私は準備ができており、他のサーバーから2つの既存のラーベールプロジェクトを追加したいと思っています。しかし、ログインページへのリダイレクト(ブラウザのアドレスとポートをパブリックフォルダから入力すると自動的にブラウザのNginxから404エラーが表示される)スクリプトは他のサーバでうまく動作し、そのサーバは「Laravelproject/storage」または他のアクセス権フォルダのエラーに過ぎません。Laravel NGINXサーバーへのプロジェクト "Permission denied" 404ブラウザエラー

は私がはい私はその安全ではないと知っているが、私は私のnginxのerror.logファイルで常に「Permission denied」エラーを取得、キャッシュクリーニングから、試行に多くのものを持っていると、すべての今、777をnginxの、PHPを再起動し、すべてのフォルダのパーミッションを確認してください。

は、ここで私は、ログファイルに常に取得エラー:ほとんどのエラーがlaravel.log

[error] 29564#0: *16 directory index of "/var/www/html/project/" is forbidden, client: ::1, server: localhost, request: "GET /project/ HTTP/1.1", host: "localhost" 

PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/project/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 

    [error] 28854#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/project/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 

ですが、そのは今、777権限を持っています。

私のnginxの構成:その、

[ErrorException]         
    passthru() has been disabled for security reasons 

しかし、私は問題thatsのだと思ういけない:

server { 
    listen 7171 ; 
    listen [::]:7171; 

    # SSL configuration 
    # 
    # listen 443 ssl default_server; 
    # listen [::]:443 ssl default_server; 
    # 
    # Self signed certs generated by the ssl-cert package 
    # Don't use them in a production server! 
    # 
    # include snippets/snakeoil.conf; 

    root /var/www/html/project/public; 

    # Add index.php to the list if you are using PHP 
    index index.php index.html index.htm index.nginx-debian.html; 

    server_name localhost; 

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

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    # 
    location ~ \.php$ { 
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
    } 



    # deny access to .htaccess files, if Apache's document root 
    # concurs with nginx's one 
    # 
    location ~ /\.ht { 
     deny all; 
    } 
} 

また、私はこのエラーを取得

php artisan serve 

でプロジェクトを実行するカントちょうど今それをブロックnginx。

アイデア?私は今このプロジェクトで数ヶ月、非常にイライラしています。私は今24時間Googleで検索し、結果なしで見つけたすべてのものを試します。私はLaravel 5.4を使用しています。かつてのサーバーはnginxではなくapacheでした。

答えて

0

解決策!この行を編集:

#try_files $uri $uri/ =404; 

をして

try_files $uri $uri/ /index.php; 

例を追加します。

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

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    # 
    location ~ \.php$ { 
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/var/run/php5-fpm.sock; 
    } 
関連する問題