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 <drodrig...@unau.edu.ar.invalid> wrote: > Here it is the curl result from the same host > > # curl -v -H Host:4.DOMAIN.edu.ar 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 > > 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 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 > > 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 > (/etc/apache2/sites-enabled/1.DOMAIN.conf:1) > port 80 namevhost 4.DOMAIN.edu.ar > (/etc/apache2/sites-enabled/1.DOMAIN.conf:1) > alias 1.DOMAIN.edu.ar > port 80 namevhost 4.DOMAIN.edu.ar > (/etc/apache2/sites-enabled/2.DOMAIN.conf:1) > alias 2.DOMAIN.edu.ar > port 80 namevhost 4.DOMAIN.edu.ar > (/etc/apache2/sites-enabled/4.DOMAIN.conf:1) > alias 4.DOMAIN.edu.ar > port 80 namevhost 4.DOMAIN.edu.ar > (/etc/apache2/sites-enabled/3.DOMAIN.conf:1) > alias 3.DOMAIN.unau.edu.ar > 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 > > <drodrig...@unau.edu.ar.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 > >>> <drodrig...@unau.edu.ar.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 [1] [1]> > >>>> > >>>> ServerName 4.DOMAIN.edu.ar [2] [2] > >>>> ServerAlias 4.DOMAIN.edu.ar [2] [2] > >>>> ServerAdmin webmas...@domain.edu.ar > >>>> > >>>> 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 [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 [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-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > >