我有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