-
解压
tar xf nginx-1.9.9.tar.gz -C /usr/local/src/ -
安装
cd /usr/local/src/nginx-1.9.9.tar.gz
./configure --prefix=/usr/local/nginx
make && make install -
做成服务
cd /etc/systemd/system
vi nginx.service
[Unit]
Description=nginx
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 stop
PrivateTmp=true
[Install]
WantedBy=muti-user.target
启动
systemctl start nginx.service
建立软连接
ln -s /usr/lib/systemd/system/nginx.service /etc/systemd/system/multi-user.target.wants/nginx.service
设置开机启动
systemctl enable nginx.service
网友评论