server - nginx設定:存取靜態檔案 403 forbidden
滿天的星座
滿天的星座 2017-05-16 17:21:07
0
3
408

nginx配置:

    server {
            listen 443;
            server_name localhost;
            ssl on;
            ssl_certificate /home/attolee/sslkey/example.crt;
            ssl_certificate_key /home/attolee/sslkey/example.key;
            ssl_session_timeout 5m;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_ciphers ALL:!ADH:!EXPORT56:-RC4+RSA:+HIGH:+MEDIUM:!EXP;
            ssl_prefer_server_ciphers on;

            location / {
                    root /home/a;
                    index index.html;
            }

            location /b/ {
                    root /home/a;
                    index b.html;
            }
   }

我想讓

  1. https://host/可以存取/home/a/index.html,

  2. https://host/b可以存取/home/a/b/b.html,

#現在1成功,2沒有成功,403 Forbidden,請問,配置哪裡出了問題?

更新

更詳細的問題描述:403 forbidden of nginx in ubuntu

滿天的星座
滿天的星座

全部回覆(3)
漂亮男人

root需要x權限:

d--------x  2 attolee attolee  4096 11月  2 21:54 hi/
滿天的星座

上面兩位的回答都是錯的!
我來跟你講:
下面那個location應該改成
location /b/ {

                root /home/a/b;
                index b.html;
        }
巴扎黑

把兩個location順序反過來
另外根據你這個配置 應該是https://host/b/能否访问到/home/a/b/b.html

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!