20
我讀nginx的初學者教程,對Serving Static Content他們我們什麼時候需要在nginx配置文件中使用http塊?
http {
server {
}
}
,但是當我添加一個HTTP模塊我得到的錯誤
[EMERG]「HTTP」指令這裏不允許使用的部分...
當我刪除HTTP模塊,改變conf文件到這一點,它工作正常:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/example.com/html;
index index.html index.htm;
# make site accessible from http://localhost/
server_name localhost
location/{
try_files $uri $uri/ /index.html;
}
我懷疑我缺少一些簡單的東西,但爲什麼他們使用http來提供靜態文件?