Vue项目打包部署Nginx配置

作者阿里云代理 文章分类 分类:linux图文教程 阅读次数 已被围观 524

单个站点

配置如下

server {  listen       80;  server_name  localhost;    location / {  root   /app;  index  index.html;  try_files $uri $uri/ /index.html;  } }

其中:

/app 是网站根目录

部署多个站点

server {  listen 80;  listen 443 ssl http2;   server_name www.demo.com;   if ($ssl_protocol = "") { return 301 https://$host$request_uri; }    # 前端  location / {  root /data/wwwroot/www;  index  index.html;  try_files $uri $uri/ /index.html;  }   # 后台  location ^~/admin {  alias /data/wwwroot/admin;  try_files $uri $uri/ /admin/index.html;  }   # 数据接口  location /api {  proxy_pass http://127.0.0.1:5000;  } }

参考

本公司销售:阿里云、腾讯云、百度云、天翼云、金山大米云、金山企业云盘!可签订合同,开具发票。

我有话说: