Home > Article > Operation and Maintenance > Analysis of Nginx installation examples in 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. Configure installation and run command
cd nginx-1.5.9/ ./configure --prefix=/usr/local/nginxMaybe
prompts missing package:
./configure: error: the http rewrite module requires the pcre library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the pcre library into the system, or build the pcre librarystatically from the source with nginx by using --with-pcre=98953a78f52873edae60a617ec082494 option.Install pcre-devel to solve the problem (needs to be running under the network and Is the super administrator identity)
yum -y install pcre-devel yum -y install openssl openssl-develTo switch to the root super administrator identity: su
Reconfigure now./configure --prefix=/usr/local/nginxIf the reconfiguration fails, you need to install gcc
yum –y install gccAfter installing gcc, configure it again 5. Compile commandmake 6. Installation commandmake install 7. After installation, start nginx cd /usr/local/nginx/sbin./nginx If the startup fails, it may be caused by a firewall problemAt this time 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 the command: nginx -s reloadGo to blog here 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 Analysis of Nginx installation examples in Linux centos7 environment. For more information, please follow other related articles on the PHP Chinese website!