How to plan a high-capacity Apache server

Source: Internet
Author: User
Article Title: how to plan a high-capacity Apache server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   I. Network Environment
----
| (Eth0: 192.168.11. | (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. B Also runs Apache for 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 a subdirectory under it. If we plan to set the WEB server web.company.com, we will 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 configuration of the virtual host in the apache configuration file/usr/local/apache/conf/httpd. conf:
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 with http://web.company.com: 82/above the transferlog and errorlog with not the default format, the year, month, or day format of one file per day is recommended on the Apache website.
Http://httpd.apache.org/docs/misc/FAQ.html#rotate
  
If other home pages need to be served on this server, for example, creating A subdirectory hr.company.com (Personnel Department) under/www, you can create an IP alias for host A, such as 192.168.11.9, perform the same port-based VM settings.
  
   Personal Homepage information
Assume that Apache runs as a user group and the user's home directory is/home/jephe, public_html is created in this directory.
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 users can upload the home page file to their own directory through FTP. Set/etc/inetd. the default value of umask uploaded by FTP in conf is 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
Back up the main directory/www/web.company.com/public/htdocswith Rsync
Related Article

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.