越来越多的网站用Vue开发。
最近这个项目,用antdv开发了一个简单的前端页面,需要部署在麒麟系统上。电脑不能上网,所以不能用apt安装nginx。
一、安装nginx
方案:下载源码编译
下载地址:http://nginx.org/en/download.html
下载最新稳定版的.tar.gz包即可
1、解压
切到nginx包目录,运行命令:
tar -zxvf nginx-1.xx.x.tar.gz
2、编译
用cd命令进入nginx目录(1.xx.x是版本号):
cd nginx-1.xx.x
配置并编译:
./configure --prefix=/home/xxxx/nginx-1.xx.x make && make install
3、我的电脑很顺序就编译成功了,可能是我电脑事先安装了openssl和pcre的缘故:
openssl安装包:https://www.openssl.org/source/
pcre安装包:https://ftp.pcre.org/pub/pcre/
二、编写配置文件
官方有给的模板,“conf”文件夹里的“nginx.conf”文件
基本的配置文件内容如下:
user root; events { worker_connections 1024; } http { include /xx/xx/xx/mime.types; # 文件mime.types所在以目录,包里就有,不必另外下载 server { listen 80; # 端口 server_name localhost; # 域名或者ip,客户机访问用的 location / { root /xx/xx/xx; # vue打包好的dist所在的目录 index index.html index.htm; # 指定首页,上述目录下的文件 } } }
三、启动服务
1、用上述配置文件启动:
./xx/xx/nginx -C /xx/xx/xx/xx.conf
注意nginx和conf文件都得是全路径
2、其他命令:
(1)停止:
./xx/xx/nginx -s stop
(2)退出:
./xx/xx/nginx -s quit
(3)重启:
./xx/xx/nginx -s reopen
我这边很顺利启动了服务
参考文章:
https://blog.csdn.net/qq_31407255/article/details/86409829
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)