1、server為我們當前要配配置的ip以及代理端口號
` server{
listen 80;
server_name localhost;
}`
2、location為我們需要代理的ip設置,包括重寫,設置超時等等。
`
localtion /api {
rewrite '^/xxl-job-admin/(.*)' /api/$1;
proxy_pass http://172.31.14.168:8080/xxl-job-admin
}
`
(.*)'.表示任意除n\字符之外的任意字符 *表示可0次或者多次出現匹配'
rewrite為重寫url設置,表示我們訪問/xxl-job-admin時,重寫前綴為/api
這樣就可以訪問localhost來訪問172.31.14.168:8080了
3、root指向根路徑下的static文件夾 默認渲染index.html頁面
、
location / {
root static;
index index.html;
}`
