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的配置文件
ServerLimit 200
<IfModule mpm_worker_module>
StartServers 2
MaxClients 5000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
NameVirtualHost *:81
<VirtualHost *:81>
<Directory /home/cms>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerName www.abc.com
ResinConfigServer 127.0.0.1 10003
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
<Location />
SetHandler caucho-request
</Location>
DocumentRoot /home/cms
DirectoryIndex index.jsp index.html index.do index.htm
ErrorDocument 503 /errorDocs/503.html
ErrorDocument 404 /errorDocs/404.html
</VirtualHost>
复制代码
以下为nginx配置文件
server {
listen *:80;
server_name www.abc.com;
index index.jsp index.html;
location / {
proxy_next_upstream error timeout http_503 http_500 http_502 http_504;
proxy_pass http://abc_www;
}
location /info {
proxy_next_upstream error timeout http_503 http_500 http_502 http_504;
proxy_pass http://abc_cms;
}
复制代码
作者:
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