: This article describes how to use yum to install nginx in CentOS7. if you are interested in the PHP Tutorial, refer to it. Use yum to install nginx's official pre-compiled package
1. configure the yum repository (CentOS/RHEL ):
Create the/etc/yum. repos. d/nginx. repo file with the following content:
[nginx]name=nginx repo# Stable version#baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/# Mainline version#baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/baseurl=http://nginx.org/packages/centos/7/$basearch/gpgcheck=0enabled=1
Note: (recommended Stable version)
"OS": it can be "centos" or "rhel", determined based on the Linux release version
"OSRELEASE": it can be 5/6/7, corresponding to 5.x; 6.x; 7.x
2. install the signature (RPM Package management uses a digital signature to verify the validity of the package)
Search for nginx signing key at the address below the nginx official website and find the signature file address.
Http://nginx.org/en/linux_packages.html#stable
user> cduser> wget http://nginx.org/keys/nginx_signing.keyuser> sudo rpm --import nginx_signing.key
3. verify that nginx configuration is successful.
User> yum search nginx: The following items are found. nginx. x86_64: High performance web server is successfully configured.
4. install nginx
user> yum install nginx
Download the installation package is only 372KB
5. Start/Stop the nginx service
** User> sudo systemctl start nginx
User> sudo systemctl stop nginx
User> sudo systemctl restart nginx
User> ps-ef | grep nginx
User> sudo kill-QUIT
# Open 80TCP port user> sudofirewall-cmd -- z/span> -- add-port = 80/tcp -- permanentuser> sudofirewall-cmd -- reload
6. configuration
The default Main configuration file is:
/Etc/nginx. conf
This file contains the *. conf file in the/etc/nginx/conf. d/directory by default.
The server {} segment related to the service is in the conf. d/default. conf file.
7. self-starting
Run the following command to set the parameters:
user> sudo systemctl enable nginx
8. disable auto-start
user> sudo systemctl disable nginx
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above describes how to install nginx with yum in CentOS7, including some content. I hope my friends who are interested in the PHP Tutorial can help me.