标签:并保存 quit 访问 fork c++ 开机自启 des mct 状态
用源码安装nginx
首先需要安装依赖包
# yum install gcc-c++
# yum install pcre
# yum install pcre-devel
# yum install zlib
# yum install zlib-devel
# yum install openssl
# yum install openssl-devel
解压安装包
tar -zxvf nginx-1.16.1.tar.gz
生成nginx-1.16.1目录,进入nginx-1.16.1.tar.gz
配置:(configure)、编译(make)、安装(make install)
# ./configure
# make
# make install
安装完的目录在/usr/local/nginx下
进入nginx/sbin, 启动nginx
在浏览器里访问,看到下面的界面,安装成功
设置nginx开机启动
在/lib/systemd/system/下创建nginx.service文件
vi /lib/systemd/system/nginx.service
nginx.service内容如下:
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx reload
ExecStop=/usr/local/nginx/sbin/nginx quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
退出并保存文件,执行systemctl enable nginx.service使nginx开机启动
# systemctl enable nginx.service
nginx其他命令:
systemctl start nginx.service (启动nginx服务)
systemctl stop nginx.service (停止nginx服务)
systemctl enable nginx.service (设置开机自启动)
systemctl disable nginx.service (停止开机自启动)
systemctl status nginx.service (查看服务当前状态)
systemctl restart nginx.service (重新启动服务)
systemctl list-units --type=service (查看所有已启动的服务)
标签:并保存 quit 访问 fork c++ 开机自启 des mct 状态
原文地址:https://www.cnblogs.com/lbkk/p/11743684.html