Post: how to plan a high-capacity Apache server?

Source: Internet
Author: User
Tags domain name server
To plan a high-capacity web server, we will do it in the following steps:

I. Network Environment

----
| (Eth0: 192.168.11.8) | (eth0: A. B. C. d)
| A | -------------------- | B | -------------> ISP
-- (Eth1: 192.168.11.5 )--
Web.company.com firewall.company.com

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 Virtual Hosts
Use port-based virtual hosts to access the staging and developer directories, corresponding to ports and 82 respectively.
The following is the section of the virtual host in the Apache configuration file/usr/local/Apache/CONF/httpd. conf.
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 port-based virtual host settings, to access the test server, with http://web.company.com: 81/
Development Server http://web.company.com: 82/
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 http://www.ford-mason.co.uk/resources/cronolog/
And then install it in/usr/local/Apache/bin/cronolog to view more information on the Apache website.
Http://httpd.apache.org/docs/misc/FAQ.html#rotate

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)
Creates an IP alias for host a, such as 192.168.11.9, and then configures the same port-based virtual host.

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.
Last with http://web.company.com /~ Jephe/visit 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 ^ (/. *) $ http: // 192.168.11.8/$1 [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.