Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Forwarding module with Apache reverse proxy server     - nginx.conf Optimization (Server)

- Linux operation and maintenance engineers face questions Intermediate (Linux)

- To help you easily protect the Linux System (Linux)

- Linux Routine Task Scheduler (Linux)

- Ubuntu system process is bound CPU core (Linux)

- RHEL7.0 environment Linux kernel upgrade (Linux)

- Depth understanding of C language (Programming)

- VMware virtual machine to install CentOS 6.2 (Linux)

- xCAT install and update software (Linux)

- Java rewrite equals method (Programming)

- Revised OpenJDK Java Memory Model (Programming)

- SQL statement to repair SQL Server database (Database)

- Chrome plug-in management, online-offline installation, part of the plug presentations (Linux)

- Testing Oracle 11g RMAN replicate database (Database)

- Linux command line under HTTP traffic sniffing tool: httpry (Linux)

- Linux system started to learn: Teaches you install Fedora 22 on VirtualBox (Linux)

- How to install Git client in Ubuntu (Linux)

- Ubuntu install OpenMPI (Linux)

- Linux software firewall ACL match point optimization (Linux)

- The Linux kernel and AVL tree in red-black tree (Programming)

 
         
  Forwarding module with Apache reverse proxy server
     
  Add Date : 2018-11-21      
         
         
         
  The origin of the problem
Company LAMP server using Apache's VirtualHost feature to deploy multiple independent domain sites. httpd.conf configuration file are the following:

# Omitted herein independent portion
Listen 80

# Www.xxx.com
< VirtualHost *>
    ServerAdmin xxx@126.com
    DocumentRoot "/ var / www / xxx"
    ServerName www.xxx.com
< / VirtualHost>

# Www.yyy.com
< VirtualHost *>
    ServerAdmin yyy@126.com
    DocumentRoot "/ var / www / yyy"
    ServerName yyy.com
    ServerAlias www.yyy.com
< / VirtualHost>

# Configure visible to other sites omitted, Apache listening on port 80, and based on the domain name to distribute requests to different web directories.

Today, the company decided on this server to add a Web site, which has an independent domain name linuxhost.com, use JavaEE development, operation based on Tomcat.

Because Apache listening on port 80 already, so stand-alone Tomcat listening on the port is no longer inevitable. The customer must visit the site in the form of http://www.linuxhost.com, and can not be http://www.linuxhost.com:8080. It must be integrated into the Apache Tomcat below.

Solutions
Apache Tomcat should be integrated into the site, there are two main ways. First, through the AJP protocol, the Apache Tomcat as the worker; the second is to use mod_proxy and mod_proxy_http module forwards the request to Tomcat.

The first way, should be high efficiency, after all, is the Apache Tomcat home products easy to integrate fairly stable.
The second approach, versatility, not only can be forwarded to Tomcat, can also be forwarded to any HTTP server program, such as IIS, another Apache instance.

According to personal preference, I chose the second way.

solution
First, let Tomcat listens on port 8080.

Then modify the httpd.conf.

# Load forwarding module
LoadModule proxy_module modules / mod_proxy.so
LoadModule proxy_http_module modules / mod_proxy_http.so

# To access all linuxhost.com forwarded to Tomcat
< VirtualHost *>
    ServerAdmin linuxhost@126.com
    ServerName linuxhost.com
    ServerAlias www.com
    ProxyPass / http: // localhost: 8080 /
    ProxyPassReverse / http: // localhost: 8080 /
< / VirtualHost>

So that when the user visits http://www.linuxhost.com, Apache will be replaced by the user and then visit http: // localhost: 8080, and the data retrieved http forwarded to users. This is the Apache reverse proxy, the proxy process for browser clients is imperceptible, to some extent, but also to protect and hide the Tomcat service (because Apache through the network http://127.0.0.1: 8080 access Tomcat service, http: //www.linuxhost.com: 8080 is not visible to the external Internet).

And reverse proxy (Reverse Proxy) corresponding to the Apache forward proxy (Forward Proxy) feature, which requires the browser proxy settings.

Future expansion
In fact, this program has a strong scalability, for the lack of public IP network Web server is very meaningful. For example, someday also need to deploy a Web site based on IIS. The domain is linuxhost.com, run within a Windows machine on the network, IP address 172.16.35.220, IIS listens on port 80. Then you can by Apache reverse proxy functionality to deploy.

< VirtualHost *>
    ServerAdmin linuxhost@126.com
    ServerName linuxhost.com
    ServerAlias www.linuxhost.com
    ProxyPass / http://172.16.35.220/
    ProxyPassReverse / http://172.16.35.220/
< / VirtualHost>
     
         
         
         
  More:      
 
- Debian users to install FFmpeg 2.2.2 (Linux)
- CUDA (including GPU card driver) installation process under Ubuntu (Linux)
- Let your PHP 7 faster the Hugepage (Linux)
- Linux based serial programming (Programming)
- Linux kernel TCP / IP parameters analysis and tuning (Linux)
- Vi syntax highlighting settings (Linux)
- Zabbix system email alert Python script (Server)
- Android 4.2 compilation notes (Programming)
- 10 example of the detection memory usage free Linux commands (Linux)
- RegExp object implements regular match --JavaScript (Programming)
- Linux user opens a number of adjustment processes (Linux)
- Oracle 11g creates virtual private directory RMAN-06004 ORA-00942 error handling (Database)
- Java open source monitoring platform Zorka basic use (Linux)
- Use Hexo quickly build and deploy a blog to Github (Server)
- Comparison of Nginx and Nginx + (Server)
- Nginx logging client ip (Server)
- Use FFmpeg processing high quality GIF (Programming)
- TNS-03505 name could not be resolved (Database)
- Construction LVM-based raw device Oracle10g Database on Oracle Linux 5.11 (Database)
- Linux static library generated Guide (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.