Tonghttpserver 反向代理设置问题记录

在项目国产化适配过程中,使用tonghttpserver进行反向代理时遇到的问题记录一下。

windows下安装tonghttpserver 参照说明文档需要注意的是 

一定需要注意斜杠与反斜杠不然httpserver.exe执行会报路径错误导致启动失败。

 

ths的配置和apache配置类似,如果熟悉apache反向代理的话,可以直接上手配置了。

下面是一个本地8080端口代理本地的8089端口程序的示例,博主用的是TongHttpServer5.0.0.1。

#HTTP port:
Listen 8080

<Proxy balancer://tongSSLCluster>
</Proxy>

#balancer node config
<Location /lbi>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from localhost
Allow From 192.168.1.0/24
</Location>

#<Location /server-status>
#SetHandler server-status
#Order Deny,Allow
#Deny from all
#Allow from localhost
#Allow From 192.168.1.0/24
#</Location>

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
#Header edit Set-Cookie "(?i)^((?:(?!;\s?Secure).)+)$" "$1; Secure"
#Header edit Set-Cookie "(?i)^((?:(?!;\s?HttpOnly).)+)$" "$1; HttpOnly"


<VirtualHost _default_:8080>
#DocumentRoot "C:/THS/mng"
#<Directory C:/THS/mng>
#Order deny,allow
#Allow from all
#</Directory>
#ProxyPassMatch ^(/.*\.jpg)$ !
#ProxyPassMatch ^(/.*\.png)$ !
#ProxyPassMatch ^(/.*\.js)$ !
#ProxyPassMatch ^(/.*\.css)$ !
#ProxyPassMatch ^(/.*\.bmp)$ !
#ProxyPassMatch ^(/.*\.gif)$ !
#ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/opt/TongWeb/THS/mng/$1
#ProxyPass / balancer://tongSSLCluster/ growth=99 maxattempts=0 nofailover=off lbmethod=bybusyness #stickysession=ROUTEID
#ProxyPassReverse / balancer://tongSSLCluster/
ProxyPreserveHost On
ProxyPass /manager http://localhost:8089/manager/
ProxyPassReverse /manager http://localhost:8089/manager/
#server name
ServerName www.test.com:8080

#server administrator
ServerAdmin you@test.com

BandWidthModule Off
ForceBandWidthModule Off
BandWidth all 0
MaxConnection all 0
BandWidthError 503

ExpiresActive On
ExpiresByType image/gif "access plus 1 days"
ExpiresByType image/jpeg  "access plus 24 hours"
ExpiresByType image/png  "access plus 24 hours"
ExpiresByType image/jpg  "access plus 24 hours"
ExpiresByType text/css  "now plus 2 hours"
ExpiresByType application/x-javascript  "now plus 2 hours"
ExpiresByType application/javascript  "now plus 2 hours"
ExpiresByType application/x-shockwave-flash  "now plus 2 hours"
ExpiresDefault "now plus 0 minutes"

#gzip
#FilterDeclare COMPRESS CONTENT_SET
#FilterProtocol COMPRESS change=yes;byteranges=no
#FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/html'"
#FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/css'"
#FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/javascript'"
#FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/javascript'"
#FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/x-javascript'"
#FilterChain COMPRESS
</VirtualHost>

#Error log
ErrorLog "| D:/WorkSoftWare/THS/bin/rotatelogs.exe D:/WorkSoftWare/THS/logs/error_log_%Y%m%d 86400 480"

#Log Level
LogLevel warn

#Log config

    #Log Format
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      #Log Format
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #Custom log
    CustomLog "| D:/WorkSoftWare/THS/bin/rotatelogs.exe D:/WorkSoftWare/THS/logs/access_log_%Y%m%d 86400 480" combined



#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    # Security Settings, Disable OPTIONS
    <Limit OPTIONS>
        Order deny,allow
        Deny from all
    </Limit>
    AllowOverride none
    #Require all denied
    Allow from localhost
</Directory>

<IfModule mpm_winnt_module>
    ThreadLimit 1920
	ThreadsPerChild 64
	MaxConnectionsPerChild 0
</IfModule>

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值