用nginx部署两个前端(超简单,三步!)

打印 上一主题 下一主题

主题 889|帖子 889|积分 2667

1.首先在nginx的html目录下创两个文件夹分别用于放两个前端打包好的静态资源,而且把静态资源各自放好:

2. 在nginx的配置文件里,写好两个server。如图,写好两个前端要用的端口以及刚才那两文件夹的路径:

  1. worker_processes  1;
  2. events {
  3.     worker_connections  1024;
  4. }
  5. http {
  6.     include       mime.types;
  7.     default_type  application/octet-stream;
  8.     server {
  9.         listen       8081;
  10.         server_name  localhost;
  11.         location / {
  12.             root   html/manage;
  13.             index  index.html index.htm;
  14.         }   
  15.         error_page   500 502 503 504  /50x.html;
  16.         location = /50x.html {
  17.             root   html;
  18.         }
  19.     }
  20. server {
  21.         listen       8082;
  22.         server_name  localhost;  
  23.         location / {
  24.             root   html/client;
  25.             index  index.html index.htm;
  26.         }
  27.         error_page   500 502 503 504  /50x.html;
  28.         location = /50x.html {
  29.             root   html;
  30.         }
  31.     }
  32. }
复制代码
3. 再双击一下nginx.exe就可以了: 


 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

惊雷无声

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表