Chinaunix

标题: 关于nginx+apache+resin负载均衡的问题。-已解决 [打印本页]

作者: yaozhibing41001    时间: 2013-04-25 14:32
标题: 关于nginx+apache+resin负载均衡的问题。-已解决
本帖最后由 yaozhibing41001 于 2013-04-25 14:44 编辑

各位大牛,下午好:

本人小白,遇到这样一个问题。问题如下:(为了简要说明问题,以下以两台机器为例,实际配置中为多台)

a, nginx服务器
b,apache+resin服务器


nginx服务器作为apache+resin服务器的负载均衡器。

apache+resin上面,跑了两个业务,程序分别放在不同目录,布署了两套apache+resin环境, 分别启动。占用 80 81端口。两套程序访问url分别为  www.abc.com 及  www.abc.com/info

www.abc.com 程序放在 /home/www
www.abc.com/info  程序放在 /home/cms/info


启动 两套 apache+resin环境后。

访问 localhost:80 及 locahost:81/info  都正常

但是通过  nginx访问时。访问 localhost:80正常 但是访问 localhost:81/info时,他列出了目录里面的文件,求解。

以下是localhost:81的配置文件
  1. ServerLimit 200
  2. <IfModule mpm_worker_module>
  3.     StartServers          2
  4.     MaxClients           5000
  5.     MinSpareThreads      25
  6.     MaxSpareThreads      75
  7.     ThreadsPerChild      25
  8.     MaxRequestsPerChild   0
  9. </IfModule>
  10. NameVirtualHost *:81
  11. <VirtualHost *:81>
  12.         <Directory /home/cms>
  13.                 Options  FollowSymLinks
  14.                 AllowOverride None
  15.                 Order allow,deny
  16.                 Allow from all
  17.         </Directory>
  18.         ServerName  www.abc.com           
  19.         ResinConfigServer 127.0.0.1 10003
  20.         CauchoConfigCacheDirectory /tmp
  21.         CauchoStatus yes
  22.         <Location />
  23.                 SetHandler caucho-request
  24.         </Location>      
  25.         DocumentRoot  /home/cms
  26.         DirectoryIndex   index.jsp index.html index.do  index.htm

  27.         ErrorDocument 503 /errorDocs/503.html
  28.         ErrorDocument 404 /errorDocs/404.html
  29. </VirtualHost>
复制代码
以下为nginx配置文件
  1. server {
  2.         listen       *:80;
  3.         server_name  www.abc.com;
  4.         index index.jsp  index.html;
  5.         location / {
  6.                 proxy_next_upstream error timeout http_503 http_500 http_502 http_504;
  7.                 proxy_pass http://abc_www;

  8.                 }
  9.         location /info {
  10.                 proxy_next_upstream error timeout http_503 http_500 http_502 http_504;
  11.                 proxy_pass http://abc_cms;

  12.                 }
复制代码

作者: yaozhibing41001    时间: 2013-04-25 14:44
谢谢各位 ,已解决。。    proxy_pass http://abc_www;   及   proxy_pass http://abc_cms;  后面忘记加一个 /  了

正确的应该是  
proxy_pass http://abc_www/;



proxy_pass http://abc_cms/;




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2