系统相关
首页 > 系统相关> > nginx 安装

nginx 安装

作者:互联网

nginx 安装

创建开机自启动

创建开机自启文件

[root@admin nginx-1.18.0]# vim /lib/systemd/system/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 quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target

设置开机自启

[root@admin nginx-1.18.0]# systemctl enable nginx.service

启动服务

[root@admin sbin]# systemctl start nginx
[root@admin nginx-1.18.0]# systemctl status nginx

标签:sbin,admin,root,1.18,nginx,usr,安装
来源: https://www.cnblogs.com/runrab/p/15792973.html