免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1969 | 回复: 1
打印 上一主题 下一主题

[Web] 关于nginx+apache+resin负载均衡的问题。-已解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-25 14:32 |只看该作者 |倒序浏览
本帖最后由 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.                 }
复制代码

论坛徽章:
0
2 [报告]
发表于 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/;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP