我有3台服务器。第一台服务器有nginx作为负载平衡。第二和第三台服务器有apache。在我的nginx的conf我有以下几点:nginx负载平衡重定向404
upstream backend {
server ec2-54-148-248-231.us-west-2.compute.amazonaws.com;
server ec2-54-148-34-166.us-west-2.compute.amazonaws.com;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location/{
proxy_pass http://backend;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
的问题是:当我打开第一个服务器重定向我的第二个或第三个,但我不能加载任何相对URL(例如:CSS或JS文件)在我的网站和所有链接返回一个404错误。
可以尝试我的负荷balaning服务器上线URL =>http://ec2-54-148-96-241.us-west-2.compute.amazonaws.com/
为什么你会把nginx放在Apache的顶端? – 2014-12-06 15:44:24
然后重新思考你的建筑。 – 2014-12-06 15:51:51