在网址中清漆nginx port_in_redirect 8080

时间:2015-03-04 06:58:26

标签: 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配置:

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

1 个答案:

答案 0 :(得分:1)

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

fastcgi_param SERVER_PORT $server_port;

为:

#fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PORT 80;

它解决了我的问题!