Project Production Environment:
Operating system: CentOS release 6.9 (Final)
Required Software:
Httpd-2.4.23.tar.gz
Apr-1.5.2.tar.gz
Apr-util-1.5.4.tar.gz
Project task: Build Nginx+apache Environment
Project Purpose: Nginx handles static requests, and dynamic requests are sent to Apache and PHP for processing. That is, Nginx acts as a front-end Web server, while Apache only processes dynamic requests at the backend, and realizes static state separation.
nginx Installation steps: http://blog.51cto.com/sky9896/1791629
Installation and use of Apache:
[Email protected] tools]# pwd
/tools
1. get the software:
[Email protected] tools]#
wget http://archive.apache.org/dist/httpd/httpd-2.4.23.tar.gz
[Email protected] tools]#
Wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
[Email protected] tools]#
Wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
[Email protected] tools]#
Wget http://exim.mirror.fr/pcre/pcre-8.10.tar.gz
2. Install the base package:
[email protected] tools]# Yum install gcc gcc-c++ zlib zlib-devel OpenSSL openssl-devel libtool pcre-devel openssl-devel –y
3. Install the configuration environment
[Email protected] tools]# TAR-ZXVF httpd-2.4.23.tar.gz
[Email protected] tools]# TAR-ZXVF apr-1.5.2.tar.gz
[Email protected] tools]# TAR-ZXVF apr-util-1.5.4.tar.gz
[Email protected] tools]# MV apr-1.5.2 HTTPD-2.4.23/SRCLIB/APR
[Email protected] tools]# MV apr-util-1.5.4 httpd-2.4.23/srclib/apr-util
[[email protected] pcre-8.10]#./configure--prefix=/usr/local/pcre && make && make install
[Email protected] httpd-2.4.23]#
./configure \
--PREFIX=/USR/LOCAL/APACHE2 \
--enable-mods-shared=all \
--enable-deflate \
--enable-speling \
--enable-cache \
--enable-file-cache \
--enable-disk-cache \
--enable-mem-cache \
--ENABLE-SSL \
--with-ssl=/usr/local/openssl/\
--enable-rewrite \
--ENABLE-SO \
--with-apr=/usr/local/apr/\
--with-apr-util=/usr/local/apr-util/\
--with-pcre=/usr/local/pcre \
--with-included-apr
[[email protected] httpd-2.4.23] #make && make install
[Email protected] bin]# pwd
/usr/local/apache2/bin
[Email protected] bin]#/apachectl #启动服务
AH00557:httpd:apr_sockaddr_info_get () failed for sky9890
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1. Set the ' ServerName ' directive globally to suppress this message
(98) Address already in use:AH00072:make_sock:could don't bind to address 0.0.0.0:80
No listening sockets available, shutting down
Ah00015:unable to open logs
#ServerName www.example.com:80 # Remove the line from the httpd.conf file
# Nginx takes up 80 port numbers
[Email protected]/]# lsof-i:80
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Aliyundun 1410 Root 18u IPv4 9251 0t0 TCP 172.19.68.202:37408->106.11.68.13:http (established)
Nginx 2123 root 6u IPv4 11508 0t0 TCP *:http (LISTEN)
Nginx 2124 Nobody 6u IPv4 11508 0t0 TCP *:http (LISTEN)
[Email protected] conf]# VI httpd.conf
Listen 8080 # modified to 8080 port, no conflict
[Email protected] bin]#./apachectl
AH00557:httpd:apr_sockaddr_info_get () failed for sky9890
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1. Set the ' ServerName ' directive globally to suppress this message
[Email protected]/]# lsof-i:8080
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
httpd 17207 root 3u IPv4 55500 0t0 TCP *:webcache (LISTEN)
httpd 17208 daemon 3u IPv4 55500 0t0 TCP *:webcache (LISTEN)
httpd 17209 daemon 3u IPv4 55500 0t0 TCP *:webcache (LISTEN)
httpd 17210 daemon 3u IPv4 55500 0t0 TCP *:webcache (LISTEN)
httpd 17306 daemon 3u IPv4 55500 0t0 TCP *:webcache (LISTEN)
Subsequent configuration (optimized Apache)
[Email protected]/]# VI/ETC/INIT.D/HTTPD
#!/bin/bash
#chkconfig: 35 85 15
/usr/local/apache2/bin/apachectl $
[Email protected]/]# chmod +x/etc/init.d/httpd
[Email protected]/]# service httpd stop
httpd (no PID file) not running
[[Email protected]/]# service httpd start
[Email protected]/]# service httpd restart
Test Address : http://101.132.79.69:8080/
It works!
Apache basic configuration and dynamic separation configuration, the next section to share.
Nginx+apache Environment