user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { server_tokens off; # 隐藏版本号 include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; gzip on; server { listen 80; root /usr/share/nginx/html; index index.html; error_page 404 /index.html; #将404错误页面重定向到index.html可以解决history模式访问不到页面问题 # location ^~/api/ { # proxy_pass http://backend:8080; # rewrite "^/api/(.*)$" /$1 break; # } } }