如何设置在单独的系统 OL7 上运行的 apache 来呈现 trac wiki 项目

如何设置在单独的系统 OL7 上运行的 apache 来呈现 trac wiki 项目

我需要以某种方式设置 apache 来显示在单独服务器上运行的 tracd 的内容。

我使用了以下配置定义:

# LB VIP1 - TRAC definition <VirtualHost "IP":8090>
#        ServerName tracwiki.com
        ServerAlias "IP of loadbalancer"
#        ServerPath "/project/"
DocumentRoot "/pkg/moip/data/apache/docs"   <Directory "/pkg/moip/data/apache/docs">
    AllowOverride None
    Options None
    Require method GET HEAD POST   
</Directory>   RewriteRule ^/project_name/(.*) http://"IP of Application server":8000/project/$1 [L,P]
    LogLevel warn core:info
    ErrorLog /pkg/moip/logs/apache/error_TRAC.log
    CustomLog /pkg/moip/logs/apache/access_TRAC.log common
    Redirect /project          https://tracwiki.com/project
#    ProxyPreserveHost On
    ProxyPass /project         http://"IP of Application server":8000/project
    ProxyPassReverse /project  http://"IP of Application server":8000/project  
    Include /pkg/moip/apps/apache/conf/extra/limits.conf </VirtualHost>* 

不幸的是,我仍然收到相同的消息“未找到内容”。服务器之间的防火墙通过端口 8000 打开(在 Web 服务器到应用程序服务器的方向)。Tracdeamon 在应用程序服务器上运行良好。

Package Version: 
Trac 1.2.3,
Genshi 0.7.1 (with speedups),
pysqlite 2.8.3,
Python 2.7.5 (default, Jul 3 2018, 06:28:28) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28.0.1)],
setuptools 0.9.8,
SQLite 3.7.17,
Subversion 1.7.14 (r1542130)  

我还安装了“flup”来使用 ajp 协议而不是 http,但不幸的是我无法正确启动网关:

[trac-scripts]$ Traceback (most recent call last):   File "/home/lcuser/trac-scripts/ajp_to_wsgi_gateway", line 36, in <module>
        from flup.server.ajp import WSGIServer   File "build/bdist.linux-x86_64/egg/flup/server/ajp.py", line 91, in <module>   File "build/bdist.linux-x86_64/egg/flup/server/ajp_base.py", line 42, in <module> ImportError: No module named _thread

我将不胜感激任何帮助。

答案1

我解决了这个问题。正如我所料,我的 VirtualHost 定义存在问题。我只需要在现有定义中添加特定的“重写规则”:

RewriteRule ^/project_name(.*) http://"IP of Application server1":8000/project_name$1 [L,P]

正确应该是这样的:

<VirtualHost "IP":8090>
    ServerName tracwiki.com
    ServerAlias "IP of loadbalancer"

DocumentRoot "/pkg/moip/data/apache/docs"   
<Directory "/pkg/moip/data/apache/docs">
    AllowOverride None
    Options None
    Require method GET HEAD POST   
</Directory>

#Prevent TRACK/TRACE requests   
    RewriteEngine on   
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)   
    RewriteRule .* - [F]
    RewriteRule [^a-zA-Z0-9|;|/|\ |\?|:|Q|&|=|\+|\$|,|\-|_|\.|\!|~|\*|\(|\)] - [F]      
    RewriteRule ^/project_name(.*) http://"IP of Application server1":8000/project_name$1 [L,P]

LogLevel warn core:info   ErrorLog /pkg/moip/logs/apache/error.log   
CustomLog /pkg/moip/logs/apache/access.log common

<IfModule mod_proxy_balancer.c>
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED  
<Proxy balancer://cluster>
    BalancerMember http://"IP of Application server2":21180 route=App_1 keepalive=on
    BalancerMember http://"IP of Application server3":21180 route=App_2 keepalive=on

    ProxySet stickysession=ROUTEID lbmethod=byrequests  
</Proxy>  
    ProxyPass / balancer://cluster/  
    ProxyPassReverse / balancer://cluster/ 
</IfModule>
Include /pkg/moip/pepsig/apps/apache/conf/extra/limits.conf </VirtualHost>*

“Server1”——专门用于 TRAC WIKI 目的

“Server2”+“Server3”——仅用于 JBOSS 实例(应用程序目的)。

相关内容