Home > Article > Operation and Maintenance > How to install Nginx in Linux centos7 environment
Detailed explanation of the steps to install nginx under linux centos7 environment
1. First go to the nginx official website to download the nginx installation package
After downloading, you will see a file similar to the following
Create the nginx-src directory and go to the nginx-src directory and run the following command:
mkdir nginx-src && cd nginx-src
Of course, you can also run the following command under Linux to download the nginx installation package
wget http://nginx.org/download/nginx-1.5.9.tar.gz
2. Unzip the nginx-1.5.9.tar.gz file
tar -zxvf nginx-1.5.9.tar.gz
3. Delete the installation package File command
rm -f nginx-1.5.9.tar.gz
4. Configuration, installation and running command
cd nginx-1.5.9/ ./configure --prefix=/usr/local/nginx
Maybe prompts missing package:
./configure: error: the http rewrite module requires the pcre library.
you can either disable the module by using --without-http_rewrite_module
option, or install the pcre library into the system, or build the pcre library
statically from the source with nginx by using --with-pcre=98953a78f52873edae60a617ec082494 option.
install pcre-devel solves the problem (needs to run under the network and be the super administrator)
yum -y install pcre-devel yum -y install openssl openssl-devel
To switch to the root super administrator: su
Reconfigure now
./configure --prefix=/usr/local/nginx
If the reconfiguration is unsuccessful, you need to install gcc
yum –y install gcc
Configure again after installing gcc
5 , Compilation command
make
6. Installation command
make install
##7. After installation, start nginxcd /usr/local/nginx/sbin./nginx If started Failure may be caused by firewall problemsAt this time, you need to turn off the firewallsystemctl stop firewalld.service 8. Visit nginxhttp://ip address 9. If you want to streamline the configuration fileReload the configuration fileRun Command: nginx -s reloadUp to here blogger, I have successfully installed the nginx server under linux centos7 and have successfully accessed nginx through the IP address on the browser.The above is the detailed content of How to install Nginx in Linux centos7 environment. For more information, please follow other related articles on the PHP Chinese website!