安装nginx |
您所在的位置:网站首页 › 麒麟系统无法启动蒸汽平台 › 安装nginx |
前言
1、安装nginx之前,在内网环境下需要先进行配置本地yum源。 2、本文使用的操作系统:银河麒麟V10 飞腾版 3、查看操作系统CPU型号 [root@localhost /]# lscpu![]() 4、查看操作系统信息 cat /etc/*release![]() 5、安装的版本:nginx-1.16.1.tar.gz 一、 获取源代码软件获取路径:http://nginx.org/download/ nginx官网:http://nginx.org/ 二、 编译环境配置执行如下命令,安装依赖包。 yum install gcc gcc-c++ make unzip pcre pcre-devel zlib zlib-devel libxml2 libxml2-devel readline readline-devel ncurses ncurses-devel perl-devel perl-ExtUtils-Embed openssl-devel -y 三、编译源代码 1) 执行以下命令,获取安装包。 wget -c http://nginx.org/download/nginx-1.16.1.tar.gz 2) 执行以下命令,解压安装包。 tar -zxvf nginx-1.16.1.tar.gz 3) 执行以下命令,进入安装目录。 cd nginx-1.16.1 4) 执行以下命令,编译安装nginx。 ./configure![]() ![]() ![]() ![]() ![]() 最后在网页上访问自己的IP就可以了默认端口为80(出现如下欢迎界面就成功了!) ![]() 内容如下: [Unit] Description=nginx service After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target[Unit]:服务的说明Description:描述服务After:描述服务类别[Service]服务运行参数的设置Type=forking是后台运行的形式ExecStart为服务的具体运行命令ExecReload为重启命令ExecStop为停止命令PrivateTmp=True表示给服务分配独立的临时空间注意:[Service]的启动、重启、停止命令全部要求使用绝对路径[Install]运行级别下服务安装的相关设置,可设置为多用户,即系统运行级别为3 保存退出。 第三步:加入开机自启动 # systemctl enable nginx如果不想开机自启动了,可以使用下面的命令取消开机自启动 # systemctl disable nginx 第四步:服务的启动/停止/刷新配置文件/查看状态 # systemctl start nginx.service 启动nginx服务 # systemctl stop nginx.service 停止服务 # systemctl restart nginx.service 重新启动服务 # systemctl list-units --type=service 查看所有已启动的服务 # systemctl status nginx.service 查看服务当前状态 # systemctl enable nginx.service 设置开机自启动 # systemctl disable nginx.service 停止开机自启动 一个常见的错误 Warning: nginx.service changed on disk. Run 'systemctl daemon-reload' to reload units.直接按照提示执行命令systemctl daemon-reload 即可。 # systemctl daemon-reload |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |