首先找到Nginx配置文件
cd /usr/local/nginx/conf
vim nginx.conf
server {
# 監(jiān)聽ip端口
listen 80;
# 主機名稱
server_name xxx.com;
# 設(shè)置字符集
#charset koi8-r;
# 虛擬server的訪問日志 相當(dāng)于局部變量
#access_log logs/host.access.log main;
location ~ ^/favicon\.ico$ {
root /tmp/web/static;
}
# 請求路徑, /表示根目錄
location / {
# 默認項目路徑
root /tmp/web;
# 索引文件名稱
index index.html;
# 解決刷新頁面變成404問題的代碼
try_files $uri $uri/ /index.html;
# 代理
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}