原文:
https://blog.csdn.net/weixin_30808693/article/details/98134035
https://blog.csdn.net/weixin_44076273/article/details/103978280
下載nginx
http://nginx.org/en/download.html
解壓即可使用
常用命令
啟動命令 : start nginx
快速關機 : nginx -s stop
優雅關機 : nginx -s quit 這個命令應該在啟動nginx的同一用戶下執行
重新加載配置文件 : nginx -s reload
重新打開日志文件 : nginx -s reopen
檢查命令 : nginx -t -c conf/nginx.conf
saber前端打包
在idea中執行打包命令就可以了:npm run build
dist文件夾里面,就是打包后的所有文件
將打包后的文件,復制到nginx的html目錄下,名稱隨便改個,我這里是改為saber
修改配置
配置文件是這個:nginx.conf
listen 1888;
location / {
root html/saber;
index index.html index.htm;
}
location ^~ /api/ {
proxy_pass http://127.0.0.1:10000/;
}
phpstudy下nginx的配置
server {
listen 1888;
server_name localhost;
location / {
root "D:\phpstudy_pro\WWW\saber";
index index.html index.htm;
}
location ^~ /api/ {
proxy_pass http://127.0.0.1:10000/;
}
}