url中的nginx端口\u重定向8080

url中的nginx端口\u重定向8080,nginx,phpmyadmin,varnish,roundcube,Nginx,Phpmyadmin,Varnish,Roundcube,我对RoundCube和phpMyAdmin都有问题。我在端口80上运行清漆,在8080上运行nginx 当我转到phpmyadmin.domain并登录时,它会将我重定向到phpmyadmin.domain:8080 当我转到webmail.domain并尝试登录时,它会不断重新加载登录页面,除非你转到webmail.domain:8080并登录,然后它就会工作 我试过了 port_in_redirect off; 但它似乎仍然需要8080 phpmyadmin的Nginx配置: s

我对RoundCube和phpMyAdmin都有问题。我在端口80上运行清漆,在8080上运行nginx

当我转到phpmyadmin.domain并登录时,它会将我重定向到phpmyadmin.domain:8080

当我转到webmail.domain并尝试登录时,它会不断重新加载登录页面,除非你转到webmail.domain:8080并登录,然后它就会工作

我试过了

    port_in_redirect off;
但它似乎仍然需要8080

phpmyadmin的Nginx配置:

server {
    listen       8080;
    server_name  phpmyadmin.domain.name;

    port_in_redirect off; 

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

    root   /var/www/phpmyadmin.domain.name/;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }
}
网络邮件的Nginx配置:

server {
    listen      8080;
    server_name webmail.domain.name;
    root        /usr/share/roundcubemail;

    port_in_redirect off;

    # Logs
    access_log  /var/log/roundcubemail/access.log;
    error_log   /var/log/roundcubemail/error.log;

    # Default location settings
    location / {
        index   index.php;
        try_files $uri $uri/ /index.php?$args;
    }

    # Redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        root /var/www/html;
    }
    #error_page  404              /404.html;

    # Pass the PHP scripts to FastCGI server (locally with unix: param to avoid network overhead)
    location ~ \.php$ {
        # Prevent Zero-day exploit
        try_files $uri =404;

    fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

        fastcgi_pass    unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

    # Deny access to .htaccess files, if Apache's document root
    location ~ /\.ht {
        deny  all;
    }

    # Exclude favicon from the logs to avoid bloating when it's not available
    location /favicon.ico {
        log_not_found   off;
        access_log      off;
    }
}

如上所述,php服务器端口是/etc/nginx/fastcgi_params I change中的问题:

fastcgi_param SERVER_PORT $server_port;
致:


它解决了我的问题

您的nginx侦听端口8080,因此侦听端口80的任何内容都与nginx无关,nginx与此无关。@AlexeyTen我理解,但其他所有内容似乎都可以顺利通过,而不需要在URL中显示8080端口,那么为什么RoundCube和phpMyAdmin有什么不同呢?很可能是php发送了这个重定向。检查fastcgi_参数文件中的内容。应该有类似服务器端口的东西。试着用80来代替它
#fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PORT 80;