-1

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;
    }
}
4

1 回答 1

1

正如上面提到的 AlexeyTen,php 服务器端口是我更改的 /etc/nginx/fastcgi_params 中的问题:

fastcgi_param SERVER_PORT $server_port;

至:

#fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PORT 80;

它解决了我的问题!

于 2015-03-06T00:45:49.673 回答