On 04/15/2021 11:00 PM, Richard wrote:
>
>> Date: Thursday, April 15, 2021 20:46:56 -0600
>> From: Jonathon Koyle <[email protected]>
>>
>> I'm not sure, but my understanding is that of you have multiple
>> virtual hosts on one machine, and they all listen on the same
>> interfaces/ip addresses then they have to have unique ServerName
>> directive. If you have duplicates, they will all be served by the
>> first virtual host, with a matching ServerName, read httpd.
>>
>> I'm not really an expert, but you need to do something like:
>> A. Distinguish the servers (distinct hostname, IP, or port).
>> B. Have a single virtual host include the definitions for all paths
>> as locations or maybe directories, could possibly maintain separate
>> files by using the include directive, not sure.
>> C. Have a single virtual host that proxies to the other defined
>> virtual host - they still need a unique name, ip or port.
> The OP may want to read up on apache name-/ip-based virtual host
> configurations:
>
> <https://httpd.apache.org/docs/current/vhosts/name-based.html>
>
> If name-based each has to be a unique (resolvable) fqdn. If IP-based,
> each has to have its own ipnumber.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
The OP, ie me, just read up on virtual host configuration. I now understand
that it is not possible to have site1.conf and site2.conf as in my first e-mail
where I wanted to access the different sites using 1.2.3.4/site1 and
1.2.3.4/site2 etc.
My reading suggests that instead accessing them as site1.1.2.3.4 and
site2.1.2.3.4 should work with the following minimal conf files:
This is site1.conf:
<VirtualHost *:80>
ServerAdmin xxx
ServerName site1.1.2.3.4
DocumentRoot /var/www/html/site1
ErrorLog /var/log/httpd/site1-error.log
CustomLog /var/log/httpd/site1-access.log combined
DirectoryIndex index.html index.php
<Directory "/site1">
Options none
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
and this is site2.conf:
<VirtualHost *:80>
ServerAdmin xxx
ServerName site2.1.2.3.4
DocumentRoot /var/www/html/site2
ErrorLog /var/log/httpd/site2-error.log
CustomLog /var/log/httpd/site2-access.log combined
DirectoryIndex index.html index.php
<Directory "/site2">
Options none
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
Is my understanding now correct?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]