Redirect Nginx从80重定向到8080
我使用nginx作为负载平衡器,但有一个问题让我感到困惑。 My nginx.conf:Redirect Nginx从80重定向到8080,redirect,nginx,Redirect,Nginx,我使用nginx作为负载平衡器,但有一个问题让我感到困惑。 My nginx.conf: upstream backend { ip_hash; server 172.16.117.200:8080 weight=1; server 172.16.117.201:8080 weight=4; } server { location / { listen 80; index index.php index.html in
upstream backend {
ip_hash;
server 172.16.117.200:8080 weight=1;
server 172.16.117.201:8080 weight=4;
}
server {
location / {
listen 80;
index index.php index.html index.htm;
proxy_pass http://backend;
}
}
server {
listen 8080;
server_name localhost;
root /var/www;
location /aa {
if ($request_uri ~* ^.*/.*$) {
rewrite ^/(mp)/(.*)$ /$1/index.php?q=$2 last;
break;
}
}
}
当我在浏览器中键入172.16.1.200/aa/时,一切正常,但如果我在浏览器中键入172.16.117.200/aa而不使用斜杠,则地址将重定向到http://172.16.117.200:8080/aa/
问题出在哪里?如果文件不在0644不正确,或者文件未找到,将使用real port重定向,请确保文件已找到,god 0644,有时它不是自动索引,或者您没有在nginx.conf设置索引,请重定向到index.php尝试使用172.16.1.200/aa/index.php 变白
upstream backend {
ip_hash;
server 172.16.117.200:8080 weight=1;
server 172.16.117.201:8080 weight=4;
}
server {
server_name localhost;
location / {
listen 80;
index index.php index.html index.htm;
proxy_pass http://backend;
}
}
进入172.16.117.200 nginx.conf
server {
server_name 172.16.117.200;
rewrite ^/(mp)/(.*)$ /$1/index.php?q=$2 last;
location / {
listen *:8080;
index index.php index.html index.htm;
root /aa;
}
}
你能编辑这个吗?你是说0644文件权限吗?