linux7 nginx开机启动,Centos7下设置Nginx开机启动
时间: 2023-07-01 15:11:24 浏览: 148
详解Centos7中Nginx开机自启动的解决办法
在CentOS 7下,设置Nginx开机启动需要进行以下步骤:
1. 将Nginx添加到系统服务中:
```
sudo systemctl enable nginx
```
2. 启动Nginx服务:
```
sudo systemctl start nginx
```
3. 检查Nginx是否已经启动:
```
sudo systemctl status nginx
```
如果Nginx已经启动,您将看到类似于以下内容的输出:
```
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-08-25 16:41:46 UTC; 4s ago
Main PID: 1234 (nginx)
CGroup: /system.slice/nginx.service
├─1234 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─1235 nginx: worker process
```
现在,每次系统启动时,Nginx将自动启动并运行。
阅读全文