鍍金池/ 問答/PHP  Linux/ linux nginx 這樣配置什么意思求解答

linux nginx 這樣配置什么意思求解答

location ~ \.php$ {
                proxy_pass http://127.0.0.1:86;
                include naprox.conf;
        }
    location ~ /\.ht {
            deny  all;
    }
    location / {
            try_files $uri @apache;
    }
    location @apache {
             internal;
             proxy_pass http://127.0.0.1:86;
             include naprox.conf;
    }

看到一個 nginx 配置是這樣的,但是看不懂啥意思,求解答!

回答
編輯回答
念舊
2017年8月10日 08:30
編輯回答
維她命

location ~ .php$ {

            proxy_pass http://127.0.0.1:86;
            include naprox.conf;
    }

//如果訪問的是 .php后綴的文件,那就將跳轉(zhuǎn)到 http://127.0.0.1:86

location ~ /.ht {

        deny  all;
}

//如果訪問的是 .ht 后綴的文件,那拒絕訪問 403

2017年5月18日 21:01
編輯回答
未命名
location ~ \.php$ {
    proxy_pass http://127.0.0.1:86;
    include naprox.conf;
}

如果是以.php結(jié)尾的文件,反向代理到http://127.0.0.1:86,再附加naprox.conf的配置

location ~ /\.ht {
    deny  all;
}

如果訪問以.ht開頭的文件,拒絕

location / {
    try_files $uri @apache;
}

location /用于最后匹配,剩下的所有請求,先嘗試訪問變量$uri對應的磁盤文件,如果文件不存在,交給@apache配置塊處理

location @apache {
    internal;
    proxy_pass http://127.0.0.1:86;
    include naprox.conf;
}

直接反代到http://127.0.0.1:86

2017年4月19日 19:36