Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add Nginx to system Services by CentOS7

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "CentOS7 how to add Nginx to system services", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "CentOS7 how to add Nginx to system services" bar!

View Servic

First check the service status of nginx, enter systemctl status nginx, and the result is as follows

If the relevant services are not found, the next step is to add system services.

Add system services

Add nginx.service to the / usr/lib/systemd/system directory and modify it according to the actual situation. For detailed analysis, see the article in Resources below. The contents are as follows

[unit] description=nginx-high performance web serverdocumentation= http://nginx.org/en/docs/after=network.target remote-fs.target nss-lookup.target [service] type=forkingpidfile=/usr/local/nginx/logs/nginx.pidexecstartpre=/usr/local/nginx/sbin/nginx-t-c / usr/local/nginx/conf/nginx.confexecstart=/usr/local/nginx/sbin/nginx-c / usr/local/nginx/conf/nginx.confexecreload=/bin/kill-s hup $mainpidexecstop=/bin/kill-s quit $mainpidprivatetmp=true [install] wantedby=multi-user.target

Let's take a look at it after it has been added.

Set the boot to start automatically

Test it first, restart it, and then check the nginx service

It didn't start. Enter systemctl start nginx to start

You can start with systemctl, indicating that there is no problem with the previously added nginx.service. Then enter systemctl enable nginx to set boot up

Finally, restart to check whether the setting is successful.

No problem, so the compilation and installation of nginx is complete, followed by the installation of php.

Thank you for your reading, the above is the content of "CentOS7 how to add Nginx to system services". After the study of this article, I believe you have a deeper understanding of how CentOS7 adds Nginx to system services, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report