CentOS 7 installs Nginx with Yum

Source: Internet
Author: User
Tags centos nginx server
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.