


CentOS 7 sets up startup service and adds custom system services centos 7 closes the firewall centos 7.2 centos 7 64-bit download
CentOS 7 sets up startup service and adds custom system services
- Create service file
- save directory
- Set auto-start at boot
- Other commands
1. Create service file
File path
<code>vim /usr/lib/systemd/<span>system</span>/nginx.service </code>
Service File content
<code><span>[Unit]</span><span>Description=<span>nginx - high performance web server</span></span><span>After=<span>network.target remote-fs.target nss-lookup.target</span></span><span>[Service]</span><span>Type=<span>forking</span></span><span>ExecStart=<span>/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</span></span><span>ExecReload=<span>/usr/local/nginx/sbin/nginx -s reload</span></span><span>ExecStop=<span>/usr/local/nginx/sbin/nginx -s stop</span></span><span>[Install]</span><span>WantedBy=<span>multi-user.target</span></span></code>
Explanation of file content
<code>[<span>Unit</span>]:服务的说明<span> Description:描述服务</span><span> After:描述服务类别</span><span> [Service]服务运行参数的设置</span><span> Type=forking是后台运行的形式</span><span> ExecStart为服务的具体运行命令</span><span> ExecReload为重启命令</span><span> ExecStop为停止命令</span><span> PrivateTmp=True表示给服务分配独立的临时空间</span><span> 注意:启动、重启、停止命令全部要求使用绝对路径</span><span> [Install]服务安装的相关设置,可设置为多用户</span></code>
2. Save the directory
Save in the directory with 754 permissions:
<code>/usr/lib/systemd/<span>system</span></code>
3. Set up auto-start on boot
Execute in any directory
<code>systemctl enable nginx<span>.service</span></code>
4. Other commands
Start nginx service
<code>systemctl <span><span>start</span> nginx.service</span></code>
Set up auto-start at boot
<code>systemctl enable nginx<span>.service</span></code>
Stop auto-start at boot
<code>systemctl disable nginx<span>.service</span></code>
View the current status of the service
<code>systemctl status nginx<span>.service</span></code>
Restart the service
<code>systemctl restart nginx<span>.service</span></code>
View all started services
<code>systemctl <span>list</span>-units --<span><span>type</span>=</span>service</code>
The above has introduced CentOS 7 to set up startup services and add custom system services, including centos 7 content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov
