Configure Apache reverse proxy

Source: Internet
Author: User
Article title: Configure Apache reverse proxy. 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.
An example is provided to describe how to configure Apache reverse proxy. Suppose there is a WWW server in the enterprise's internal network. We hope this server can provide external WWW services by connecting to the Intemet firewall.
In this way, the WWW Server can be isolated from the external world to improve security. In this case, we need to install the Apache server on the firewall to provide proxy access to the WWW server. At the same time, combined with the virtual host technology we introduced earlier, the firewall is used as an Apache virtual host, so that the home page on the firewall will not be accessed. WWW server in internal LAN
The IP address is 192.168.1.2, the internal IP address of the firewall host is 192.168.1.1, and the external IP address is 202.5.83.124.
  
To configure Apache on the firewall, follow these steps.
  
(1) add the virtual host configuration in the/etc/httpd/conf/httPd. conf file.
NameVirtualHost 202.5.83.124
Servername www.company.com
Errorlog/var/log/httpd/error-log
Transferlog/var/log/httpd/access-log
Rewriteengine On
Proxyrequests off
Usecanonicalname off
Rewriterule ^/(. *) $ http: // 192.168.1.2 $1 [P, L]
  
(2) configure the DNS server in the Lan and direct www.company.com to 202.5.83.124. In this way, all accesses to the IP address 202.5.83.124 will be directed to the internal WWW server.
Server. We also need to modify the configuration of the WWW server in the LAN. the specific steps are as follows.
1] Apache uses the default configuration. The main directory is/home/httpd/html, the host domain name is company.com.cn, the alias is www.company.com, and the following alias is added to srm. conf.
Definition.
Alias/pub/home/ftp/pub/
DefaultType application/octet-stream
  
2] add an item in/etc/hnpd/conf/access. conf.
Options lndexes
AllowOverride AuthConfiq
Order allow, deny
Allow from all
  
3] delegate the. htaccess file to the/home/ftp/pub Directory. the content is as follows.
# Cat. htaccess
AuthName Branch Office Public Software Download Area
AuthType Basic
AuthUserFile/etc/. usrpasswd
Require valid-user
  
4] run the following command:
# Htpasswd-c/etc/. usrpasswd user1
  
Create different external usernames and passwords that allow access to the/pub file service.
  
  

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.