Compiling Apache+php4+mysql (RPM) on a Linux firewall

Source: Internet
Author: User
apache|mysql| Compiler | Firewall purpose: A Redhat Linux 6.2 for firewall, dedicated line link chinanet, internal link

LAN segment 192.168.11.0/24, need to enable PHP4 and MySQL database, and LAN
There is another Apache server 192.168.11.2 that needs to be serviced by external users, leveraging
The function of Apache reverse proxy and name virtual host compiled on firewall to realize

Address: Firewall external address is a.b.c.210, and alias second address is a.b.c.211, internal network card
Address is 192.168.11.5, the Apache server on the internal LAN is 192.168.11.2

Realize:
1. Download three source files to/tmp of the firewall machine
Apache_1.3.12.tar.gz
Mysql-3.22.32.tar.gz
Php-4.0.1pl2.tar.gz


2. Unlock three documents separately in/TMP

# tar Xvfz apache*gz
# tar Xvfz mysql*gz
# tar Xvfz php*gz

3. Enter/tmp/mysql*, compile MySQL
#./configure--prefix=/usr/local/mysql
#make
#make Install
#scripts/mysql_install_db
#/usr/local/mysql/bin/safe_mysqld &
#/usr/local/mysql/bin/mysqladm-u Root Password NewPassword

4. Enter/tmp/php*, compile PHP4
#./configure--with-mysql--with-apache=. /apche_1.3.12
--enable-track-vars
#make; make install


5. Download reverse proxy x-forward-for module, address is
Http://perl.apache.org/guide/download.html#mod_proxy_add_forward
Put the file mod_proxy_add_forward.c to/tmp/apache_1.3.12/src/modules/after downloading
The extra/directory

5. Compile Apache, join PHP4 module and most shared module library
./configure--prefix=/usr/local/apache
--activate-module=src/modules/php4/libphp4.a
--activate-module=src/modules/extra/mod_proxy_add_forward.c
--enable-module=most--enable-shared=max

6. Copy Php.ini-dist to other directory
# cd/tmp/php*
# CP Php.ini-dist/usr/local/lib/php.ini

7. Edit the AddType line in/usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php4. php

8. Edit the Addmodule line in/usr/local/apache/conf/httpd.conf,

Put the Mod_proxy_add_forward before the mod_proxy.

9. Add the following line at the end of the/usr/local/apache/conf/httpd.conf
Namevirtualhost 202.96.240.210


ServerName host.yourdomain.com
Errorlog/var/log/httpd/shopu/error_log
Transferlog/var/log/httpd/shopu/access_log
Rewriteengine on
Rewriterule ^ (/.*) $ http://192.168.11.2/$1 [p,l]
#rewritelog/var/log/httpd/shopu/rewrite_log
#rewriteloglevel 9
Proxyrequests off

Where two lines of Rewritelog and Rewriteloglevel help find rewriterule If you remove the comment
Recording


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.