Use APACHE2 Reverse proxy PHP application under Ubuntu

Source: Internet
Author: User

Recently helped a friend to build a discuz! forum, because his server actually has an official website, only registered a domain name, want to put Discuz forum also hang under this domain name. The official website application is written in the Java language, so think of using the reverse proxy function to Apache2, the root of the domain name to the official website, and sub-level directory/forum to PHP parsing discuz.

Steps:

#系统更新: Apt-get update#mysql installation, configuration: Apt-get install mysql-server mysql-client/usr/bin/mysql_ Secure_installation#apache2 installation, configuration: APT-GET&NBSP;INSTALL&NBSP;APACHE2&NBSP;LIBAPACHE2-MOD-AUTH-MYSQL#PHP5 installation, Configure:apt-get install php5 php5-mcrypt php5-curl php5-mysqlservice apache2  restart# upload source files:  apache2 and PHP5 after installation, the default root directory is located under  /var/www , so, in the directory under the new  forum  directory, Upload all files under the Discuz upload directory to  /var/www/forum . #配置Apache2的反向代理功能: #修改/etc/apache2/apache2.conf:cd / etc/apache2/vi apache2.conf<directory /car/www/>options indexes followsymlinks# allowoverride noneallowoverride all# pay attention to this line require all granted</directory># Load Reverse Proxy module a2enmod proxy_httpservice apache2 restart# Configure the reverse proxy application: #再次介绍实际情况: # A website application (Java) should be configured at the root of the domain name (http://www.xxx.com), #一个discuz应用应该配置在子层目录下 (Http://www.xxx.com/forum), # Currently the official website app has been published under Tomcat (http://127.0.0.1:8080), only need to deploy discuz. Cd /etc/apache2/sites-available/cp 000-default.conf qianxiangnet-proxy.conf qianxiangnet-forum.confvi  qianxiangnet-proxy.conf<virtualhost *:80>    serveradmin [email  protected]    servername www.xxx.com    documentroot /var/ www    proxypreservehost on    proxypass /forum http:// 127.0.0.2/forum    proxypass / http://127.0.0.1:8080/     </VirtualHost>vi qianxiangnet-forum.conf<VirtualHost 127.0.0.2:80>     ServerAdmin [email protected]    DocumentRoot /var/www     ......</virtualhost>a2ensite qianxiangnet-proxy qianxiangnet-foruma2dissite 000- Defaultservice apache2 restart

ok! Access http://www.xxx.com and Http://www.xxx.com/forum should be accessible at this time .

Reference Links:

Tutorial:apache 2.4 As Reverse proxy



This article is from the "Keep_study_zh" blog, make sure to keep this source http://zhkpsty.blog.51cto.com/9013616/1728662

Use APACHE2 Reverse proxy PHP application under Ubuntu

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.