我正在嘗試學習 nginx,這個簡單的測驗在訪問 localhost:81/test 時給了我 404。我基本上希望在 /test 上顯示相同的索引頁。
我在本地計算機上從 Windows 使用 nginx。從http://nginx.org/en/docs/windows.html下載并通過在 bash-terminal 中運行 ./nginx.exe 開始
tldr: localhost:81 給我索引頁, localhost:81/test 給我 404
我的 nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 81 ;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /test {
root html;
index index.html index.htm;
}
}
}
uj5u.com熱心網友回復:
不得不更換root html同alias html在location /test-塊
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/339943.html
標籤:nginx
