Local agent, develop online interface. Nginx reverse proxy is used. The result is that the home page can only be accessed with index.html, and the direct access slash / is 404.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 10;
upstream serverip {
server xx.xx.xx.xx;
}
server {
listen 80;
server_name a.com;
location =/ {
add_header X-Frame-Options SAMEORIGIN;
index index.html;
}
location ~* \.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|swf|woff|woff2|ttf|json|svg|cur|vue|otf|eot)$ {
charset utf-8;
root D:/WWW/app;
expires 3d;
}
location / {
proxy_pass http://serverip;
}
}
}
hosts:
127.0.0.1 a.com
if I change the configuration to the following, I can access it in both ways: http://a.com/ and http : / / a.com/index.html
location =/ {
add_header X-Frame-Options SAMEORIGIN;
root D:/WWW/app;
index index.html;
}
location ~* \.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|swf|woff|woff2|ttf|json|svg|cur|vue|otf|eot)$ {
charset utf-8;
root D:/WWW/app;
expires 3d;
}
take a look at the log
D:WWWappnginx/html/index.html "is not found (3: The system cannot find the path specified),
explain here, my project directory:
www/app/index.html
www/app/nginx/*
I want to ask, do I have to configure two root? Can I configure two root?