Darryl,

You can use * without the port under one specific condition:

You only listen to a single TLS or non-TLS port, and all vhosts are
configured to accept the traffic accordingly

Otherwise, you risk overlapping TLS and non-TLS vhosts, and your vhost will
not function properly.

On Tue, 21 Sept 2021 at 15:53, Darryl Philip Baker <
darryl.ba...@northwestern.edu> wrote:

> I have ~200 virtualhosts on my Apache HTTPD server and all use the
> declaration “<VirtualHost *>” with not port specification. Just a “Listen
> 80” directive. Do you specify the port on the VirtualHost directive because
> you don’t want to accept traffic on all the ports there are Listen
> directives for?
>
>
>
> *Darryl Baker, *GSEC  (he/him/his)
>
> Sr. System Administrator
>
> Distributed Application Platform Services
>
> *Northwestern University*
>
> 1800 Sherman Ave.
>
> Suite 6-600 – Box #39
>
> Evanston, IL  60201-3715
>
> *darryl.ba...@northwestern.edu <darryl.ba...@northwestern.edu>*
>
> (847) 467-6674 <+18474676674>
>
>
>
>
>
> *From: *Frank Gingras <thu...@apache.org>
> *Reply-To: *"users@httpd.apache.org" <users@httpd.apache.org>
> *Date: *Tuesday, September 21, 2021 at 2:32 PM
> *Cc: *"users@httpd.apache.org" <users@httpd.apache.org>
> *Subject: *Re: [users@httpd] Four subdomain, fourth redirects to first
>
>
>
> 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
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar:80__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-6Yzyngw$>
> >
>
>    ServerName 4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
>    ServerAlias 4.DOMAIN.edu.ar
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
>    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
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> http://INTERNAL-IP/
> <https://urldefense.com/v3/__http:/INTERNAL-IP/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-egXBcKA$>
> * 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
> <https://urldefense.com/v3/__http:/4.DOMAIN.edu.ar__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z488acxDmw$>
> > 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
> <https://urldefense.com/v3/__http:/1.DOMAIN.edu.ar/xmlrpc.php__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z4-gS0xl8g$>
> < X-Redirect-By: WordPress
> < Location: https://1.DOMAIN.edu.ar/
> <https://urldefense.com/v3/__https:/1.DOMAIN.edu.ar/__;!!Dq0X2DkFhyF93HkjWTBQKhk!EtnL5-sA9HbWlSvJ4AlphiGpOTSpF2DWidf_FdJdBQsmqyStwOp8duNsSrlWiao5z484EV85Bg$>
> < 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
>
>

Reply via email to