CentOS 7 installs Nginx with Yum
In CentOS 7, installing NIGNX directly with Yum will prompt for no download source. Therefore, you need to add Nginx download source to Yum:
sudo rpm-uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Once you have specified the download source, you can use the Yum command to install Nginx:
sudo yum install-y nginx
The installed Nginx does not start immediately and requires us to manually execute the command to open it:
sudo systemctl start Nginx.service
You can also enter the following command to allow Nginx to start automatically with the system:
sudo systemctl enable Nginx
Next open the browser, access to the local address http://localhost can see Nginx welcome page ~
You can also enter the following command on the server to see the public IP address of the Nginx server, and then enter the IP on the client browser is also accessible:
IP addr
Related supplements:
# Open Nginx
service nginx start
# stop Nginx
service nginx Stop
# restart Nginx
service nginx Restart
# view Nginx State
Service Nginx status
Nginx's default site root directory is
/usr/share/nginx/html/
The default site configuration is
/etc/nginx/conf.d/default.conf
Nginx main configuration is as follows
/etc/nginx/nginx.conf
In this configuration file, the include directive is used, and other local configuration files are included in the main configuration file, which makes the configuration file more organized and easier to maintain. Tags CentOS, Linux, Nginx, original