server { listen 8080; server_name localhost; location / { root html index index.html try_files $uri $uri/ /index.html; #try_files:如果对应目录不存在,就回去index.html } }