Welcome! Log In Create A New Profile

Advanced

Configurations strangeness - mistake or bug?

Gábor Kövesdán
November 15, 2014 07:24PM
Hi,

I'm facing a strange issue configuring virtual hosts on a server. I
don't see any misconfiguration yet it does not work as I expect it. I'd
like to ask for your help in debugging this. If the configuration is
incorrect, we can improve the documentation so that others do not commit
this mistake or if there is a bug in nginx, this could help in fixing it.

The problem is that I have two main domains, let's refer to them as
foobar.com and foo-bar.com (yes, one of them has a hyphen) and I want to
set up webmail and phpmyadmin canonical names that serve the
corresponding service and only allows https access. When unencrypted
http is used, it should redirect to the https version. The corresponding
part of the configuration is pasted below. The problem with this is that
it does not work as expected.
In Chrome, http://phpmyadmin.foo-bar.com erroneously redirects to
https://webmail.foobar.com, while http://phpmyadmin.foobar.com redirects
properly. The rest is fine.
In Firefox, surprisingly the redirection is different.
http://phpmyadmin.foo-bar.com works properly but
http://phpmyadmin.foobar.com redirects to https://webmail.foobar.com.
The rest works.

I cannot figure out where the wrong redirection comes from and why it
behaves differently in different browsers. Do you have any guess? Or any
suggestions how I could debug this?

Thanks in advance,
Gábor Kövesdán


server {
listen [::]:80;
server_name webmail.foobar.com www.webmail.foobar.com
webmail.foo-bar.com www.webmail.foo-bar.com;
return 301 https://webmail.foobar.com;
}

server {
listen [::]:80;
server_name phpmyadmin.foobar.com www.phpmyadmin.foobar.com
phpmyadmin.foo-bar.com www.phpmyadmin.foo-bar.com;
return 301 https://phpmyadmin.foobar.com;
}

server {
listen [::]:443 ssl;
server_name webmail.foobar.com www.webmail.foobar.com
webmail.foo-bar.com www.webmail.foo-bar.com;

root /usr/local/www/squirrelmail;

error_log /var/log/nginx/foobar.com-error.log error;
access_log /var/log/nginx/foobar.com-access.log main;

include php.conf;
}

server {
listen [::]:443 ssl;
server_name phpmyadmin.foobar.com www.phpmyadmin.foobar.com
phpmyadmin.foo-bar.com www.phpmyadmin.foo-bar.com;

root /usr/local/www/phpMyAdmin;

error_log /var/log/nginx/foobar.com-error.log error;
access_log /var/log/nginx/foobar.com-access.log main;

include php.conf;
}


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Configurations strangeness - mistake or bug?

Gábor Kövesdán November 15, 2014 07:24PM

Re: Configurations strangeness - mistake or bug?

mex November 16, 2014 04:57AM

Re: Configurations strangeness - mistake or bug?

Gábor Kövesdán November 16, 2014 06:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready