2016-06-28 5 views
0

ちょうど物のアーチ側に来た。私はAntergosで動作するように私のローカルLEMPスタックを取得するのに苦労しています。現在、サーバーブロックローカルページは403エラーを返しています。Antergos Linux - LEMPスタック - Nginx 403

/etc/nginx/nginx.conf:

#user html; 
worker_processes 1; 

#error_log logs/error.log; 
#error_log logs/error.log notice; 
#error_log logs/error.log info; 

#pid  logs/nginx.pid; 


events { 
    worker_connections 1024; 
} 


http { 
    include  mime.types; 
    include  sites-enabled/*; 
    default_type application/octet-stream; 

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
    #     '$status $body_bytes_sent "$http_referer" ' 
    #     '"$http_user_agent" "$http_x_forwarded_for"'; 

    #access_log logs/access.log main; 

    sendfile  on; 
    #tcp_nopush  on; 

    #keepalive_timeout 0; 
    keepalive_timeout 65; 

    #gzip on; 

    server { 
     listen  80; 
     server_name localhost; 

     #charset koi8-r; 

     #access_log logs/host.access.log main; 

     location/{ 
      root /usr/share/nginx/html; 
      index index.html index.htm; 
     } 

     #error_page 404    /404.html; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root /usr/share/nginx/html; 
     } 

     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 
     # 
     #location ~ \.php$ { 
     # proxy_pass http://127.0.0.1; 
     #} 

     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
     # 
     #location ~ \.php$ { 
     # root   html; 
     # fastcgi_pass 127.0.0.1:9000; 
     # fastcgi_index index.php; 
     # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
     # include  fastcgi_params; 
     #} 

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


    # another virtual host using mix of IP-, name-, and port-based configuration 
    # 
    #server { 
    # listen  8000; 
    # listen  somename:8080; 
    # server_name somename alias another.alias; 

    # location/{ 
    #  root html; 
    #  index index.html index.htm; 
    # } 
    #} 


    # HTTPS server 
    # 
    #server { 
    # listen  443 ssl; 
    # server_name localhost; 

    # ssl_certificate  cert.pem; 
    # ssl_certificate_key cert.key; 

    # ssl_session_cache shared:SSL:1m; 
    # ssl_session_timeout 5m; 

    # ssl_ciphers HIGH:!aNULL:!MD5; 
    # ssl_prefer_server_ciphers on; 

    # location/{ 
    #  root html; 
    #  index index.html index.htm; 
    # } 
    #} 

} 

/etc/nginx/sites-available/projects.local

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

    server_name project.local www.project.local; 

    root /home/l/install/project/www; 

    access_log /home/l/install/project/www/log/access.log; 
    error_log /home/l/install/project/www/log/error.log; 

     location/{ 
      index index.html index.htm index.php; 
     } 

     location ~ \.php$ { 
       fastcgi_split_path_info ^(.+\.php)(/.+)$; 
       fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
       fastcgi_index index.php; 
       include fastcgi_params; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     } 

} 

とエラー・ログの最後のエントリ:

"GET /test/index.html HTTP/1.1"、ホスト: "project.local" 2016年6月28日午前12時18分45秒 [エラー] 28652#28652:* 1オープン() クライアント:127.0.0.1、サーバー:project.local、リクエスト: "GET/test HTTP/1.1"、ホスト: "/ home/l/install/project/www/test"が失敗しました(13:許可が拒否されました) project.local」

とWWWフォルダのLSの-la明らかにする: 合計12 drwxr-XR-X 3リットルのユーザー4096 -la

[リットル@リットルプロジェクト] $ lsのJun 28 10:14。 drwxr-XR-×4 Lユーザー4096 6月28日午前10時13分.. WWWフォルダ内 drwxrwxrwx 4Lのユーザー4096

テストフォルダがあり、また、L 'ユーザ' と試験フォルダ内index.phpもそれぞれlとusersに属しています。

編集:閉じるとみなされる質問。 Ubuntu 16.04 Gnomeに移行しました。

答えて

0

wwwディレクトリを/homeの外側に移動してみてください。たとえば、/srv/wwwに移動でき、htmlユーザーおよびグループに、ディレクトリの所有者を変更します。

sudo mv /home/l/www /srv 
sudo chown -R html:html /srv/www 

はあなたnginx.confに応じて更新してください。それが役に立てば幸い!

+0

私は以前にサーバーブロック(仮想ホスト)とchownコマンドを試していました。当分、私はUbuntu Gnomeに戻った。とにかくありがとうございました!! – dottel

0

私は「質問は閉じたと見なされています」という行を見ていますが、これをぶつかる可能性がある他の人のために答えを出します。

あなたがさまざまな理由でオーナー/グループを変更するファンでない場合は、権限を変更することで逃げることができます。ファイルの読み込み権限が必要です(変更していないものとします)。フォルダにアクセスするには、読み取りと実行の両方が必要です。したがって

chmod -R o+rx /home/1/www 

注これはおそらく、ライブサイトのための良いアイデアではありませんが、テスト目的のためにうまくそれをカットする必要があること。

+0

ありがとうございます。ページは1分に数回のように頻繁に変化します。それは開発環境です。 – dottel

関連する問題