首页 > 其他 > 详细

对部署_nginx_pm2_docker的研究 2

时间:2020-07-06 12:08:52      阅读:42      评论:0      收藏:0      [点我收藏+]
 
      Nginx 反向代理 + 前端打包Dist
       
     
      yum install nginx
       ----
      apt update
      apt install nginx
     添加静态路由
# /etc/nginx/sites-enable/taro 
server {
listen 80;
server_name taro.josephxia.com;
location / {
root /root/source/taro-node/dist;
index index.html index.htm;
}
}
# 验证Nginx配置
nginx -t
# 重新启动Nginx
service nginx restart
nginx -s reload
# /etc/nginx/sites-enable
# taro
# /etc/nginx/sites-enable
# taro
server {
listen 80;
server_name taro.josephxia.com;
location / {
root /root/source/taro-node/dist;
index index.html index.htm;
}
location ~ \.(gif|jpg|png)$ {
root /root/source/taro-node/server/static;
}
location /api {
proxy_pass http://127.0.0.1:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# 查看配置?件位置
nginx -t
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
# nginx: configuration file /etc/nginx/nginx.conf test is successful
#重启
service nginx restart
nginx -reload
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

对部署_nginx_pm2_docker的研究 2

原文:https://www.cnblogs.com/zhouyideboke/p/13254049.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!