Use Apache to configure Tomcat apps to integrate PHP forum-discuz

Source: Internet
Author: User

Recently engaged in a Web application, master Tomcat-based Java applications, need to integrate PHP forum Discuz

The Tomcat application port is 8101, the APAHCE port is 80, and the website domain name is www.linuxidc.com

Use the XAMPP server to directly integrate Apache and PHP installation discuz.

Now you want to reach the Tomcat master using www.linuxidc.com Access, the Discuz forum is accessed using Www.linuxidc.com/bbs

Since the Tomcat port is 8101 and cannot be accessed directly through www.linuxidc.com, Apache VirtualHost is required to implement

The configuration is as follows:

<virtualhost *:80>

Proxypass/bbs!

proxypass/http://linuxidc.com:8101/myweb/

proxypassreverse/http://linuxidc.com:8101/myweb/

Proxypassreversecookiepath//

</VirtualHost>

Explain

proxypass/http://linuxidc.com:8101/myweb/

Indicates that access to the Web site root directory will be delegated access to the address is the Tomcat application address, note that: The end of the path must be/end, otherwise it will not be accessed properly

proxypassreverse/http://linuxidc.com:8101/myweb/

Reverse proxy remains consistent with Proxypass

Proxypassreversecookiepath//

Cookie path, must be configured, otherwise site session will be lost, cookie cannot be saved, here configuration indicates root node cookie path is/(can also be configured as other as:)

Proxypassreversecookiepath//myweb

Proxypass/bbs!

Indicates that the/bbs directory does not have proxy access, that is, BBS uses Apache direct access, if the item is not configured, access to/bbs will use Tomcat to access

The settings are complete to be accessed as expected. However, one problem is that the session cannot be consistent through http://www.linuxidc.com and http://linuxidc.com, which means that I use linuxidc.com to log in and then use

www.linuxidc.com access, the logon session is lost.

View cookie path discovery, keep session cookie domain different, one is www.linuxidc.com, one is linuxidc.com. By checking the information and saying that to be consistent, the cookie domain must be set to

. linuxidc.com, note that there must be a dot before the domain name, do not add www and http.

However, it is not valid to use the Apache configuration item Proxypassreversecookiedomain to set this case because the master cookie is set by Tomcat and the configuration using Apache is invalid. So you must

Modify the Tomcat configuration, modify the Conf/context.xml

<context sessioncookiepath= "/" sessioncookiedomain= ". linuxidc.com" >

This way, access through http://www.linuxidc.com and http://linuxidc.com will keep the session consistent.

This article is an individual's experience of checking information and practice, and some of them are wrong (or have a better plan).

    • This article is from: Linux Tutorial Network

Use Apache to configure Tomcat apps to integrate PHP forum-discuz

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.