Home > Operation and Maintenance > Nginx > How to install nginx in CentOS7 environment

How to install nginx in CentOS7 environment

王林
Release: 2020-05-06 16:33:42
forward
3070 people have browsed it

How to install nginx in CentOS7 environment

Note: Users need to have root permissions

First step, add Nginx repository

To add CentOS 7 EPEL repository, please open a terminal and use the following command:

sudo yum install epel-release
Copy after login

Step 2, install Nginx

Now that the Nginx repository has been installed on your server, use the following yum command to install Nginx:

sudo yum install nginx
Copy after login

After answering yes to the prompt, Nginx will complete the installation on the server.

The third step is to start Nginx

Nginx will not start by itself. To run Nginx, enter:

sudo systemctl start nginx
Copy after login

If you are running a firewall, run the following command to allow HTTP and HTTPS communication:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Copy after login

You will see the default CentOS 7 Nginx web page, This is for informational and testing purposes. It should look like this:

How to install nginx in CentOS7 environment

#If you see this page, then your web server is now installed correctly.

If you want to enable Nginx when the system starts. Please enter the following command:

sudo systemctl enable nginx
Copy after login

Congratulations! Nginx is now installed and running!

Recommended tutorial: nginx usage tutorial

The above is the detailed content of How to install nginx in CentOS7 environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template