小编Dmi*_*kun的帖子

nginx 重定向回 remote_addr IP

我正在尝试将 nginx 1.0.12 设置为 apache 2.2.15 的代理,但遇到了一个奇怪的问题。而且我连续第三天都无法解决它。我有测试站点 c-craft.info 并在 /roundcube 子目录中安装了 roundcube。所以这里的问题是:

如果您尝试打开http://c-craft.info/roundcube,您将奇怪地重定向回您自己的 IP 地址。所以看起来nginx试图从remote_addr下载静态文件。但是,如果您将尾部斜杠添加到 uri 中,例如roundcube/,它将起作用。

另一个例子:尝试打开http://www.contra.lv - 你也将重定向回你自己的 IP 地址,nginx 再次尝试从 remote_addr 下载静态文件。

有趣的是,通过 apache 连接效果很好:

c-craft.info:9091/roundcube

contra.lv:9091

我真的需要你的建议如何修复它,因为我被卡住了......这是我当前的配置文件:

配置文件

user nginx;
worker_processes 2;
pid /var/run/nginx.pid;

events {
    worker_connections 2048;
    use epoll;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] $request '
    '"$status" $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    client_max_body_size 64m;
    client_body_buffer_size 256k;

    sendfile on; …
Run Code Online (Sandbox Code Playgroud)

nginx reverse-proxy apache-2.2

5
推荐指数
1
解决办法
1619
查看次数

标签 统计

apache-2.2 ×1

nginx ×1

reverse-proxy ×1