部署优点:浏览器访问时,无#锚点,均为全路径,例如:
废话就不说了,nginx.conf配置见下:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 85;
server_name localhost;
root C:\My-Codes\dacoo-data-stand-alone-web\dist;
location / {
try_files $uri $uri/ /index.html;
}
location ~ ^/(api)/ {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9802;
}
}
}