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 system Services for Nginx by CentOS7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "how CentOS7 adds system services for Nginx". In daily operation, I believe many people have doubts about how CentOS7 adds system services for Nginx. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how CentOS7 adds system services for Nginx". Next, please follow the editor to study!

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.

At this point, the study on "how CentOS7 adds system services for Nginx" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report