博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx部署
阅读量:3931 次
发布时间:2019-05-23

本文共 1270 字,大约阅读时间需要 4 分钟。

windows版

绿色版nginx,下载解压即可使用。

vue编译之后会生成dist文件夹,目录结构如下:
|——index.html
|——static
|——|——css
|——|——js
|——|——img
|——|——fonts

是一个单页面的应用,资源都是静态的,可以使用nginx做静态资源服务器。

步骤:

  1. 安装nginx,例如D:\nginx-1.13.12;
  2. 进入D:\nginx-1.13.12\html文件夹,将vue编译后生成的dist文件夹放进去;
  3. 修改D:\nginx-1.13.12\conf的nginx.conf文件;
server {
listen 801; #监听端口,默认801,即nginx启动后访问端口 server_name 10.20.61.55; #监听地址,改为真实Ip,便于任何人访问 #charset koi8-r; #access_log logs/host.access.log main; # 项目访问 http://10.20.61.55:801进入/配置,显示dist下的index.html location / {
#root html; root D:/nginx-1.13.12/html/dist; # 配置为vue项目放置目录,配合history路由模式 index index.html index.htm; try_files $uri $uri/ /index.html; #配合history路由模式,解决页面一刷新404问题 } # 反向代理,重定向后台请求,当输入http://10.20.61.55:801/ruoyi-admin/时,重定向到http://10.20.61.55:8080/ruoyi-admin/ location ^~ /ruoyi-admin/ {
proxy_pass http://10.20.61.55:8080/; #后台部署的真实路径 }}
  1. 打开cmd窗口,进入D:\nginx-1.13.12,执行 nginx -t 命令,检查刚修改的nginx.conf文件是否有语法错误;
    修改nginx.conf文件后,最好执行下该命令,以防错误;
D:\nginx-1.13.12>nginx -tnginx: the configuration file D:\nginx-1.13.12/conf/nginx.conf syntax is oknginx: configuration file D:\nginx-1.13.12/conf/nginx.conf test is successfulD:\nginx-1.13.12>
  1. 启停命令;
D:\nginx-1.13.12>start nginx	#启动D:\nginx-1.13.12>nginx -s stop	#停止D:\nginx-1.13.12>nginx -s reload	#重启

转载地址:http://wzqgn.baihongyu.com/

你可能感兴趣的文章
3.8 - Using the Print Function
查看>>
3.9.1 - Lists in Python
查看>>
3.9.2 - Lists - Adding and Removing Objects
查看>>
3.9.3 - Sorting Lists
查看>>
3.10 - Maya Commands: ls
查看>>
3.11 - Dictionaries in Python
查看>>
3.12 - Tuples in Python
查看>>
4.4 - For Loops
查看>>
4.2.2 - Logical and/or Operators
查看>>
Lesson 4 Part 2 Softmax Regression
查看>>
文章中运用到的数学公式
查看>>
Projective Dynamics: Fusing Constraint Projections for Fast Simulation
查看>>
从2D恢复出3D的数据
查看>>
glm 中 数据类型 与 原始数据(c++ 数组)之间的转换
查看>>
Derivatives of scalars, vector functions and matrices
查看>>
the jacobian matrix and the gradient matrix
查看>>
VS2010 将背景设为保护色
查看>>
ubutun里面用命令行安装软件
查看>>
ubuntu 常用命令
查看>>
SQLite Tutorial 4 : How to export SQLite file into CSV or Excel file
查看>>