preface

Nginx is a high-performance Web server software. It is a more flexible and lightweight application than the Apache HTTP server. You must have the root permission for the installation

operation

1. Add a CentOS 7 EPEL warehouse

sudo yum install epel-release
Copy the code

2. Install Nginx

sudo yum install nginx
Copy the code

3. Start the Nginx

sudo systemctl start nginx
Copy the code

4. Test nginx service:

Wget HTTP: / / http://127.0.0.1Copy the code

If the command output is as follows, the Nginx service is normal.

[root@hostname ~]Wget # http://127.0.0.1- the 2017-05-11 20:32:34 - http://127.0.0.1/ Connecting to 127.0.0.1:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3700 (3.6K) [text/ HTML] Saving to:'index.html'100% [= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = >] 3700 -. - K/sin 0s

2017-05-11 20:32:34 (632 MB/s) - 'index.html' saved [3700/3700]
Copy the code

5. Start the firewall

sudo systemctl start firewalld.service
Copy the code

6. Allow HTTP and HTTPS transmission

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
Copy the code

7. Enter the server IP address in the browser. If Welcome to nginx is displayed, the installation is successful

How To Install CentOS 7