Re: Four subdomain, fourth redirects to first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The host I'm using was originally named accordingly with the task assigned back then, now one of the vhosts has the same name.

But, after noticed the issue just renamed the conf, and now everything is working as expected.


Thank you all for your time and patience.-


El 2021-09-21 19:51, Frank Gingras escribió:
Why do you have two vhosts with the same ServerName value set? That
will break name-based vhosts. Set a unique ServerName value for every
vhost on that port.

On Tue, 21 Sept 2021 at 18:25, Daniel Armando Rodriguez
<drodriguez@xxxxxxxxxxx.invalid> wrote:

Here it is the curl result from the same host

# curl -v -H Host:4.DOMAIN.edu.ar [1] http://INTERNAL-IP/
* Expire in 0 ms for 6 (transfer 0x5573684c6c10)
*   Trying INTERNAL-IP...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x5573684c6c10)
* Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
GET / HTTP/1.1
Host:4.DOMAIN.edu.ar [1]
User-Agent: curl/7.64.0
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 22:10:39 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host INTERNAL-IP left intact

Querying to localhost

# curl -v -H Host:4.DOMAIN.edu.ar [1] http://localhost/
* Expire in 0 ms for 6 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 1 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
* Expire in 0 ms for 1 (transfer 0x5556238fac10)
*   Trying ::1...
* TCP_NODELAY set
* Expire in 150000 ms for 3 (transfer 0x5556238fac10)
* Expire in 200 ms for 4 (transfer 0x5556238fac10)
* Connected to localhost (::1) port 80 (#0)
GET / HTTP/1.1
Host:4.DOMAIN.edu.ar [1]
User-Agent: curl/7.64.0
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 22:13:01 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host localhost left intact

From apachectl -S I see the problem is related to what vhost is set
as
default
VirtualHost configuration:
*:80                   is a NameVirtualHost
default server 4.DOMAIN.edu.ar [1]
(/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
port 80 namevhost 4.DOMAIN.edu.ar [1]
(/etc/apache2/sites-enabled/1.DOMAIN.conf:1)
alias 1.DOMAIN.edu.ar [2]
port 80 namevhost 4.DOMAIN.edu.ar [1]
(/etc/apache2/sites-enabled/2.DOMAIN.conf:1)
alias 2.DOMAIN.edu.ar [3]
port 80 namevhost 4.DOMAIN.edu.ar [1]
(/etc/apache2/sites-enabled/4.DOMAIN.conf:1)
alias 4.DOMAIN.edu.ar [1]
port 80 namevhost 4.DOMAIN.edu.ar [1]
(/etc/apache2/sites-enabled/3.DOMAIN.conf:1)
alias 3.DOMAIN.unau.edu.ar [4]
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

El 2021-09-21 18:48, Frank Gingras escribió:
Show the httpd -S output and results from your tests with curl,
then.

It might help to log the host: header in your access log too.

On Tue, 21 Sept 2021 at 17:41, Daniel Armando Rodriguez
<drodriguez@xxxxxxxxxxx.invalid> wrote:

Changed all vhosts definition the way you suggested, but the
issue
still
happens.

El 2021-09-21 16:32, Frank Gingras escribió:
The first mistake is to use the hostnames when defining vhosts.
Define
them all as *:PORT, then test with curl, and run apachectl -S or
httpd
-S to spot any overlap.

On Tue, 21 Sept 2021 at 14:48, Daniel Armando Rodriguez
<drodriguez@xxxxxxxxxxx.invalid> wrote:

Hi,

I have four subdomains on the same host which work as expected
whis
this
base config

<VirtualHost 4.DOMAIN.edu.ar:80 [5] [1] [1]>

ServerName 4.DOMAIN.edu.ar [1] [2] [2]
ServerAlias 4.DOMAIN.edu.ar [1] [2] [2]
ServerAdmin webmaster@xxxxxxxxxxxxx

DocumentRoot /var/www/4

<Directory "/var/www/4">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error_4.log
CustomLog ${APACHE_LOG_DIR}/access_4.log combined

</VirtualHost>

In the particular case of fourth subdomain, gets redirected to
the
first. See

# curl -v -H Host:4.DOMAIN.edu.ar [1] [2] [2]
http://INTERNAL-IP/
* Expire in 0 ms for 6 (transfer 0x55669ac96c10)
*   Trying INTERNAL-IP...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x55669ac96c10)
* Connected to INTERNAL-IP (INTERNAL-IP) port 80 (#0)
GET / HTTP/1.1
Host:4.DOMAIN.edu.ar [1] [2] [2]
User-Agent: curl/7.64.0
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Tue, 21 Sep 2021 18:32:32 GMT
< Server: Apache/2.4.48
< X-Pingback: http://1.DOMAIN.edu.ar/xmlrpc.php
< X-Redirect-By: WordPress
< Location: https://1.DOMAIN.edu.ar/
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host INTERNAL-IP left intact

As said, domains 1, 3 and 3 works. In fact, when configuring
the
4th

just copied the one of the working configs and changed the
subdomain,
directory and also the log. Nothing more, but the result is not
the
one
I expected.

Any hint will be much appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux