How to plan a high-capacity Apache server

Source: Internet
Author: User
Tags domain name server

A is a web server inside the lan. Install Redhat Linux 6.xand compile Apache + PHP4 + MySQL

B is the company firewall, and the external address is a. B .c.d, which is the only path to the Internet. Run Apache on B

Reverse proxy to internal machine B. Assume that the company's domain name is @ company.com, and B is the Domain Name Server of this domain.

Ii. Organizational Structure of WEB directories

We plan to place the WEB server data file under a separate directory/www, and then create the corresponding

Subdirectory. If we plan to set the WEB server web.company.com, create a directory.

/Www/web.company.com with the following structure:

/Www/web.company.com/public/htdocs

/Cgi-bin

/Www/web.company.com/staging/htdocs

/Cgi-bin

/Www/web.company.com/#/htdocs

/Cgi-bin

Iii. Access methods and

Use port-based access to the staging and developer directories, corresponding to ports and 82 respectively.

The following section describes the configuration file/usr/local/apache/conf/httpd. conf of apache.

Configuration:

Listen 80

Listen 192.168.11.8: 81

Listen 192.168.11.8: 82

<VirtualHost 192.168.11.8: 81>

Documentroot/www/web.company.com/staging/htdocs/

Scriptalias/cgi-bin/www/web.company.com/staging/cgi-bin/

Transferlog "|/usr/local/apache/bin/cronolog/usr/local/apache/logs/web/staging/% Y/% m/% d/access_log"

Errorlog "|/usr/local/apache/bin/cronolog/usr/local/apache/logs/web/staging/% Y/% m/% d/error_log"

</VirtualHost>

<VirtualHost 192.168.11.8: 82>

Documentroot/www/web.company.com/#/htdocs/

Scriptalias/cgi-bin/www/web.company.com/#/cgi-bin/

Transferlog "|/usr/local/apache/bin/cronolog/usr/local/apache/logs/web/developer/% Y/% m/% d/access_log"

Errorlog "|/usr/local/apache/bin/cronolog/usr/local/apache/logs/web/developer/% Y/% m/% d/error_log"

</VirtualHost>

Note: The above is a port-based setting. To access the test server, use

Development Server

The preceding transferlog and errorlog are not in the default format, but are recommended on the Apache website every day.

The year/month/day format of a file, which can be downloaded and compiled from

And then install it in/usr/local/apache/bin/cronolog to view more information on the Apache website.

If there are other home pages that need to be served on this server, for example, create a subdirectory hr.company.com (Personnel Department) under/www)

You can create an IP alias for host A, such as 192.168.11.9, and perform the same port-based settings.

Iii. Personal Homepage information

If Apache runs as a user group and the user's home directory is/home/jephe, create a directory in this directory

Public_html

A. Set the user's main directory/home/jephe to give the nobody group the read and execute permissions

Chmod 750-R/home/jephe

B. Set the public_html directory permission in the user's home directory/home/jephe.

Chmod-R 2770/home/jephe/public_html

C. Set the owner of the user's home directory

Chown-R jephe. nobody/home/jephe/public_html

You can upload the home page file to your directory through FTP. You need to set the default umask value uploaded by FTP in/etc/inetd. conf.

U002,

Ftp stream tcp nowait root/usr/sbin/tcpd in. ftpd-l-a-u002

Then use killall-HUP inetd to take effect.

Finally, access the personal homepage.

Iv. Apache reverse proxy on firewall machine B

The settings are as follows:

NameVirtualHost a. B. c. d

<VirtualHost a. B. c. d>

Servername web.company.com

Errorlog "|/usr/local/apache/bin/cronolog/var/log/httpd/web/% Y/% m/% d/error_log"

Transferlog "|/usr/local/apache/bin/cronolog/var/log/httpd/web/% Y/% m/% d/access_log"

Rewriteengine on

Rewriterule ^ (/. *) $ [P, L]

Proxyrequests off

</VirtualHost>

V. Backup

Use Rsync to back up the home directory/www/web.company.com/public/htdocs. For more information, see

For other articles in this article, visit rsync.samba.org.

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.