[root@nginx01 sbin]# systemctl start nginx [root@nginx01 sbin]# systemctl status nginx ● nginx.service - nginx - web server Loaded: loaded (/usr/lib/systemd/system/nginx.service; static; vendor preset: disabled) Active: active (running) since Thu 2022-03-31 21:44:28 CST; 21s ago Process: 12084 ExecStart=/usr/local/nginx/v1.24.0/sbin/nginx -c /usr/local/nginx/v1.24.0/conf/nginx.conf (code=exited, status=0/SUCCESS) Process: 12081 ExecStartPre=/usr/local/nginx/v1.24.0/sbin/nginx -t -c /usr/local/nginx/v1.24.0/conf/nginx.conf (code=exited, status=0/SUCCESS) Main PID: 12085 (nginx) CGroup: /system.slice/nginx.service ├─12085 nginx: master process /usr/local/nginx/v1.24.0/sbin/nginx -c /usr/local/nginx/v1.24.0/conf/nginx.conf └─12086 nginx: worker process
Mar 31 21:44:28 nginx01.centos.gg.com systemd[1]: Starting nginx - web server... Mar 31 21:44:28 nginx01.centos.gg.com nginx[12081]: nginx: the configuration file /usr/local/nginx/v1.24.0/conf/nginx.conf syntax is ok Mar 31 21:44:28 nginx01.centos.gg.com nginx[12081]: nginx: configuration file /usr/local/nginx/v1.24.0/conf/nginx.conf test is successful Mar 31 21:44:28 nginx01.centos.gg.com systemd[1]: Started nginx - web server.
设置为开机启动
1 2
[root@nginx01 ~]# systemctl enable nginx.service Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.