关于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>
OptionsFollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerNamewww.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.doindex.htm
ErrorDocument 503 /errorDocs/503.html
ErrorDocument 404 /errorDocs/404.html
</VirtualHost>以下为nginx配置文件server {
listen *:80;
server_namewww.abc.com;
index index.jspindex.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;
} 谢谢各位 ,已解决。。 proxy_pass http://abc_www; 及 proxy_pass http://abc_cms;后面忘记加一个 /了
正确的应该是
proxy_pass http://abc_www/;
及
proxy_pass http://abc_cms/;
页:
[1]