原文:
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/;
}
}