Home Operation and Maintenance Nginx Analysis of Nginx installation examples under CentOS

Analysis of Nginx installation examples under CentOS

May 11, 2023 pm 08:28 PM
centos nginx

Installation environment: linux server centos 7.3, root permissions

1, install the prerequisites:

sudo yum install yum-utils

2 , to set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

(Note to replace the os version: $releasever, for example, the centos version is 7, Replace it with 7)

Command:

Use vim to edit the nginx.repo file

vim /etc/yum.repos.d/nginx.repo

Set the yum source of nginx:

Paste the following content into the nginx.repo file

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
Copy after login

Enter the vim command: wq Save and exit

3. To install nginx, run the following command:

sudo yum install nginx
You will enter y to confirm the installation

4.When prompted to accept the gpg key, verify that the fingerprint matches 573b fd6b 3d8f bc64 1079 a6ab abf5 bd82 7bd9 bf62, and if so, accept it.

Finally, the fingerprint will be output. If it matches the red part above, enter y again to confirm

5. Start | Stop | Restart nginx:

# 启动
systemctl start nginx.service

# 停止
systemctl stop nginx.service

# 重启
systemctl restart nginx.service
Copy after login

6. View all installation locations of nginx:

rpm is the rpm package management tool for Linux, -q represents query mode, -l represents return list

rpm -ql nginx

7. nginx configuration file:

/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
Copy after login

The above is the detailed content of Analysis of Nginx installation examples under CentOS. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check the running status of nginx How to check the running status of nginx Apr 14, 2025 am 11:48 AM

The methods to view the running status of Nginx are: use the ps command to view the process status; view the Nginx configuration file /etc/nginx/nginx.conf; use the Nginx status module to enable the status endpoint; use monitoring tools such as Prometheus, Zabbix, or Nagios.

How to set nginx access address to server ip How to set nginx access address to server ip Apr 14, 2025 am 11:36 AM

To set the access address to server IP in Nginx, configure the server block, set the listening address (such as listen 192.168.1.10:80) Set the server name (such as server_name example.com www.example.com), or leave it blank to access the server IP and reload Nginx to apply the changes

How to stop the command line in nginx How to stop the command line in nginx Apr 14, 2025 pm 12:36 PM

Steps to stop Nginx from the command line: 1. Find the Nginx process ID (PID); 2. Use the kill or systemctl command to stop the Nginx process with PID; 3. Verify that Nginx is stopped by using ps -ef | grep nginx to check the Nginx process.

How to start nginx in Linux How to start nginx in Linux Apr 14, 2025 pm 12:51 PM

Steps to start Nginx in Linux: Check whether Nginx is installed. Use systemctl start nginx to start the Nginx service. Use systemctl enable nginx to enable automatic startup of Nginx at system startup. Use systemctl status nginx to verify that the startup is successful. Visit http://localhost in a web browser to view the default welcome page.

How to solve nginx403 error How to solve nginx403 error Apr 14, 2025 pm 12:54 PM

The server does not have permission to access the requested resource, resulting in a nginx 403 error. Solutions include: Check file permissions. Check the .htaccess configuration. Check nginx configuration. Configure SELinux permissions. Check the firewall rules. Troubleshoot other causes such as browser problems, server failures, or other possible errors.

How to configure nginx in Windows How to configure nginx in Windows Apr 14, 2025 pm 12:57 PM

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

How to solve nginx499 error How to solve nginx499 error Apr 14, 2025 pm 12:42 PM

Resolve Nginx 499 error: The Nginx 499 error indicates that the client closes the connection before the server processes the request, which is usually caused by a client timeout or a connection interruption. Solutions include: checking client timeout settings; improving server flow limits; checking load balancer configuration; optimizing server response time; enabling KeepAlive; checking firewall rules; and contacting network service providers.

How to check whether nginx is started? How to check whether nginx is started? Apr 14, 2025 pm 12:48 PM

In Linux, use the following command to check whether Nginx is started: systemctl status nginx judges based on the command output: If "Active: active (running)" is displayed, Nginx is started. If "Active: inactive (dead)" is displayed, Nginx is stopped.

See all articles