Nginx+apache building static and dynamic separation

Source: Internet
Author: User
Tags bz2 install php ini openssl php code phpinfo zip nginx reverse proxy

1.nginx Reverse proxy server commonly known as "static and dynamic Separation" (I have a simple installation here)
First step: Install Apache

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.bz2


Tar jxf httpd-2.4.25.tar.bz2
CD httpd-2.4.25
./configure--prefix=/usr/local/apache-enable-so--enable-proxy-enable-rewrite \
-with-mpm-worker--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre
Make && make install

Resolves a problem with compiling Apache: Configure:error:APR not found. Please read the documentation
Yum Remove apr-util-devel Apr apr-util-mysql apr-docs apr-devel apr-util Apr-util-docs

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget Http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz


Resolving Apr not found issues
TAR-ZXF apr-1.4.5.tar.gz
CD apr-1.4.5
./configure--PREFIX=/USR/LOCAL/APR
Make && make install

Solve Apr-util not found problem
TAR-ZXF apr-util-1.3.12.tar.gz
CD apr-util-1.3.12
./configure--prefix=/usr/local/apr-util-with-apr=/usr/local/apr/bin/apr-1-config
Make && make install

Solve pcre problems
Unzip-o Pcre-8.10.zip
CD pcre-8.10
./configure--prefix=/usr/local/pcre

After the installation is successful Apache starts/usr/local/apache/bin/apachectl start (Access your IP) appears below OK

It Works

Step Two: Install PHP

Yum Install GD zlib zlib-devel OpenSSL openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel
wget Http://cn2.php.net/get/php-5.6.29.tar.gz/from/this/mirror
Tar zxf php-5.6.29.tar.gz
CD php-5.6.29

./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs \
--WITH-GD--enable-gd-native-ttf--enable-gd-jis-conv--with-openssl--enable-mbregex \
--enable-bcmath--enable-mysqlnd--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-zlib-dir--enable-mbstring= All

Make && make install

CP Php.ini-development/usr/local/php/lib/php.ini (copy php.ini configuration file)

Vim/usr/local/apache/conf/httpd.conf
Configure Apache files to insert rows between the main profile <ifmodule mime_module><\ifmodule>
AddType application/x-httpd-php PHP (let Apache parse php files)

/usr/local/apache/bin/apachectl Restart (restart Apache)

vim/usr/local/apache/htdocs/index.php (write some PHP code to see if parsing does not work, self-Baidu)

Part III: Installing Nginx (the port should be 8080)

wget http://nginx.org/download/nginx-1.8.0.tar.gz
Tar zxf nginx-1.8.0.tar.gz
CD nginx-1.8.0
./configure--prefix=/usr/local/src/nginx--with-pcre=/usr/local/ngingxpcre (detection configuration)

Make && make install

The PCRE error is resolved as follows

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz

Tar jxf pcre-8.39.tar.bz2
MV Pcre-8.39.tar.bz2/usr/local/nginxpcre

Modify Nginx configuration file after installation is complete

Vim/usr/local/nginx/conf/nginx.conf

Modify the following code (change the original 80 port to 8080)


Start Nginx

/usr/local/nginx/sbin/nginx this is OK

Test yourself and edit index.php.

vim/usr/local/apache/htdocs/index.php

Like what:

<?php

Phpinfo ();

?>


Enter your nginx HTML directory to upload a picture of the name to correspond to the Lord.

Access your IP like 192.168.1.71:8080/index.php (remember that you have now changed the Nginx port to 8080)

appear the picture is related to phpinfo content description you've done it. I don't know


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.