CentOS6.5 compile and install Nginx and Openssl
Nginx is a lightweight Web server/reverse proxy server and email (IMAP/POP3) proxy server, which is released under a BSD-like protocol. Developed by Russian programmer Igor Sysoev, Rambler is used by Russia's large entry-level website and search engine Rambler (RUSSIAN: Russian. It is characterized by a small amount of memory and high concurrency. In fact, nginx's small file concurrency performance is better in the same type of web servers.
Nginx compilation and installation:
1. Download Openssl
[root@Node1~]
#wgethttp://www.openssl.org/source/openssl-1.0.2.tar.gz
2. Download nginx
[root@Node1~]
#wgethttp://nginx.org/download/nginx-1.6.2.tar.gz
3. decompress the software
[root@Node1~]
#tarzxfopenssl-1.0.2.tar.gz
[root@Node1~]
#tarzxfnginx-1.6.2.tar.gz
4. Compile Nginx
[root@Node1~]
#cdnginx-1.6.2
[root@Node1nginx-1.6.2]
#./configure--user=www--group=www--prefix=/data/nginx1.6.2--with-http_stub_status_module--with-http_gzip_static_module--with-http_ssl_module--with-openssl=/root/openssl-1.0.2
Note: Compile nginx to add ssl support. If openssl needs to be compiled, opensll does not need to be compiled. -- with-openssl = DIR is the source code path of openssl, not the installation path of openssl, otherwise, an error occurs during make:
make
[1]:Enteringdirectory`
/root/nginx-1
.6.2'
cd
/server/openssl
\
&&
make
clean\
&&.
/config
--prefix=
/server/openssl/openssl
no-sharedno-threads\
&&
make
\
&&
make
install
make
[2]:Enteringdirectory`
/server/openssl
'
make
[2]:***Noruleto
make
target`clean'.Stop.
make
[2]:Leavingdirectory`
/server/openssl
'
make
[1]:***[
/server/openssl/openssl/include/openssl/ssl
.h]Error2
make
[1]:Leavingdirectory`
/root/nginx-0
.7.61'
make
:***[build]Error2
If
.
/configure
:error:theHTTPrewritemodulerequiresthePCRElibrary.
Youcaneitherdisablethemodulebyusing--without-http_rewrite_module
option,or
install
thePCRElibraryintothesystem,orbuildthePCRElibrary
staticallyfromthe
source
withnginxbyusing--with-pcre=<path>option.
This indicates that the pcre & pcre-devel package is not installed. Here, yum is installed.
[root@Node1nginx-1.6.2]
#yum-yinstallpcrepcre-devel
5. Install Nginx
[root@Node1nginx-1.6.2]
#make
[root@Node1nginx-1.6.2]
#makeinstall
6. Check nginx before starting
[root@Node1nginx-1.6.2]
#/data/nginx1.6.2/sbin/nginx-t
nginx:theconfiguration
file
/data/nginx1
.6.2
/conf/nginx
.confsyntaxisok
nginx:[emerg]getpwnam(
"www"
)failed
nginx:configuration
file
/data/nginx1
.6.2
/conf/nginx
.conf
test
failed
Check that the user is not running and add a www account
[root@Node1nginx-1.6.2]
#groupaddwww
[root@Node1nginx-1.6.2]
#useradd-gwww-s/sbin/nologin-d/dev/nullwww
7. Check again
[Root @ Node1 nginx-1.6.2] #/data/nginx1.6.2/sbin/nginx-t
Nginx: the configuration file/data/nginx1.6.2/conf/nginx. conf syntax is OK
Nginx: configuration file/data/nginx1.6.2/conf/nginx. conf test is successful
8. Start Nginx
[root@Node1nginx-1.6.2]
#/data/nginx1.6.2/sbin/nginx
9. Check the port
[root@Node1nginx-1.6.2]
#netstat-ntlup|grep:80
tcp000.0.0.0:800.0.0.0:*LISTEN19849
/nginx
10. Check the process
[root@Node1nginx-1.6.2]
#psaux|grepnginx
root198490.00.022664852?Ss11:190:00nginx:masterprocess
/data/nginx1
.6.2
/sbin/nginx
www198500.00.1231001448?S11:190:00nginx:workerprocess
root198580.00.0103244856pts
/0
S+11:210:00
grep
nginx
11. Website access
This article from the "Fenglin late" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1617167