Common Errors and solutions for installing nginx in centos
1. After Nginx is installed, why cannot I access the site?
A common problem with nginx installation is that it cannot be accessed outside the site. The local wget and telnet operations are normal. In addition to servers, hosts on the LAN or on the Internet cannot access the site. If telnet is used, the following message is displayed:
Connecting to 192.168.0.xxx..the connection to the host cannot be opened. Port 80: Connection Failed
If you use the wget command, the prompt is:
Connecting to 192.168.0.100: 80... failed: No route to host.
If the fault occurs, it is likely that port 80 is blocked by the CentOS firewall. Run the following command to open port 80:
Iptables-I INPUT-p tcp -- dport 80-j ACCEPT
Then use:
/Etc/init. d/iptables status
View the current firewall rule. If such a rule is found:
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 80
It indicates that the firewall rules have been added successfully, and access outside the site will be normal.
2. pcre compilation error (pcre must be installed before nginx installation in source code)
Libtool: compile: unrecognized option '-DHAVE_CONFIG_H'
Libtool: compile: Try 'libtool -- help' for more information.
Make [1]: *** [pcrecpp. lo] Error 1
Make [1]: Leaving directory '/usr/local/src/pcre-8.21'
Make: *** [all] Error 2
Solution: Install g ++. Do not forget to re-configure
Apt-get install g ++
Apt-get install build-essential
Make clean
./Configure
Make
3. make Error
Make: *** No rule to make target 'build', needed by 'default'. Stop.
./Configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
Into the system, or build the OpenSSL library statically from the source
With nginx by using -- with-openssl = <path> option.
Solution in ubuntu:
Apt-get install openssl
Apt-get install libssl-dev
Solution Under centos:
Yum-y install openssl-devel
4. Dependency software prce, ssl, and zlib Installation Error
1) if an error is reported
./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 = <path> option.
Install the pcre package
Pcre
Tar zxvf pcre-8.12.tar.gz
Cd pcre-8.12
./Configure
Make
Make install
2) if an error is reported
./Configure: error: the HTTP cache module requires md5 functions
From OpenSSL library. You can either disable the module by using
-- Without-http-cache option, or install the OpenSSL library into the system,
Or build the OpenSSL library statically from the source with nginx by using
-- With-http_ssl_module -- with-openssl = <path> options.
Openssl needs to be installed
Tar zxvf openssl-0.9.8g.tar.gz
Cd openssl-0.9.8g
./Config -- prefix =/usr/local/-- openssldir =/usr/local/openssl-g3 shared zlib-dynamic enable-camellia
Make
Make install
Test whether the installation is successful: openssl version
3) if an error is reported
Configure: error: zlib not found.
Install: gzip.tar.gz
Tar zxvf gzip.tar.gz
./Configure
Make
Make install