Installation steps:1. Download Nginx, execute: wget http://nginx.org/download/nginx-1.10.2.tar.gz2, decompression, execution: Tar vxzf nginx-1.10.2.tar.gz3, installation, switch to the Nginx decompression directory, execution:./configure--prefix=/usr/local/nginx
problems encountered:Executive times Error:checking for C compiler ... not found./configure:error:c compiler cc is not found
Cause: missing compilation environment
Solution:install GCC, execute: Yum install gcc4, continue to execute:./configure--prefix=/usr/local/nginx
problems encountered:./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=<path> option.
reason: missing rewrite module, need to install Pcre library (regular expression)
Solution:Install Pcre Library, execute: Yum install pcreInstall Pcre-devel after installation (development use package): Yum install Pcre-devel5. After the installation is complete, execute again./configure--prefix=/usr/local/nginx6. Installation, execution: Make && make install7, switch to/usr/local issued existing Nginx directory, installation completed8, continue to switch to/usr/local/nginx under the directory to see:
.... conf configuration file
... HTML Web page file
... logs log files
... sbin main binary program
9, start Nginx, execute:./sbin/nginx
problems encountered:the startup process may occur: Nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already on use)
Cause:80 ports are occupied
Solution:Execute: NETSTAT-ANTP (or NETSTAT-TUNLP) to view the program that occupies the port, such as: kill Process, execute: kill-9 2985//2985 is process number10, start again, execute:./sbin/nginx boot success without any hint
Visit:after successful installation, the host can be accessed directly via the virtual machine IP, the Nginx Welcome page will appear normally, but the windows can ping the host IP, but the execution: Telnet IP port cannot be accessed, which may be a problem with Linux firewall. Note: Telnet Open method: Control Panel---> Programs and Features---> Turn Windows features on or off---> tick the telnet Server and Telnet client two options, click OK---> Perform a telnet attempt under the Windows windowthen perform the following operations to allow access to port 80:1,/sbin/iptables-i input-p tcp--dport 80-j ACCEPT2./etc/init.d/iptables Save3,/etc/init.d/iptables restartThe operation is reflected as follows: at this point, again access to the host IP address can appear the Nginx welcome page, the host has access to the virtual machine Nginx service.
Installation of Nginx on CentOS