前言 1、安装Nginx之前,在内网环境下需要先进行配置本地yum源。 2、本文使用的操作系统:银河麒麟V10 飞腾版 3、查看操作系统CPU型号 [root@localhost /]# lscpu
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
wget -c http://nginx.org/download/nginx-1.16.1.tar.gz
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1
./configure
make -j4 && make install
useradd nginx
chown nginx:nginx /usr/local/nginx
cd /usr/local/nginx/sbin/./nginx -v
cd /usr/local/nginx/sbin/./nginx
ps -ef | grep nginx
最后在网页上访问自己的IP就可以了默认端口为80(出现如下欢迎界面就成功了!)
[root@localhost ~]# cd /lib/systemd/system/
# vim nginx.service
内容如下:
[Unit]Description=nginx serviceAfter=network.target[Service]Type=forkingExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s quitPrivateTmp=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 停止开机自启动
直接按照提示执行命令systemctl daemon-reload 即可。
# systemctl daemon-reload
来源地址:https://blog.csdn.net/qq_30665009/article/details/126021796
--结束END--
本文标题: 安装nginx--银河麒麟V10(Kylin Linux Advanced Server release V10 (Tercel))操作系统
本文链接: https://www.lsjlt.com/news/401855.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0