Mailing List Archive

Related question on having multiple subdomains on one host
I have been trying to configure running both php 7.0 and 7.2 on one host, certain sites using the former and others the latter. That's another thread though.

However, I have some more questions given that my configuration is x.x.x.x/site1, x.x.x.x/site2 etc, I have separate conf files in /etc/httpd/conf.d/, one for each of site1, site2 etc, using this format:

<VirtualHost *:80>
        ServerAdmin xxxx
        ServerName x.x.x.x
        DocumentRoot /var/www/html/
        Include /etc/httpd/conf.d/rh-php70-php-fpm.conf
        ErrorLog /var/log/httpd/site1-error.log
        CustomLog /var/log/httpd/site1-access.log combined
</VirtualHost>

The above is for x.x.x.x/site1, the others are similar except using site2 etc etc. The sites are in /var/www/html/site1, /var/www/html/site2 etc.

- Is this the correct format? Ie, I shall have one <VirtualHost *:80> in each of those files? Or, does this need to be configured differently?

- I want to log x.x.x.x/site1 errors to its own file, site1-error.log, and all accesses to site1 to its own file, the customlog file above. Site2 should be logged to its files etc. Yet I seem to end up with logentries for different subsites in the files which makes me suspect something is incorrectly configured...



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Related question on having multiple subdomains on one host [ In reply to ]
Do reach of your virtual hosts have a unique ServerName? x.x.x.x is not a
very descriptive example.
Re: Related question on having multiple subdomains on one host [ In reply to ]
9 aprile 2021 21:51, "H" <agents@meddatainc.com> wrote:

> etc, I have separate conf files in /etc/httpd/conf.d/, one for each of site1, site2 etc, using this
> format:
>
> <VirtualHost *:80>
> ServerAdmin xxxx
> ServerName x.x.x.x
> DocumentRoot /var/www/html/
> Include /etc/httpd/conf.d/rh-php70-php-fpm.conf
> ErrorLog /var/log/httpd/site1-error.log
> CustomLog /var/log/httpd/site1-access.log combined
> </VirtualHost>

You are having problems with automatically inclusion of files inside conf.d. This is not an apache
configuration but a solution given by your linux distribution (redhat/centos/etc).

To make things cleaner, my opinion, you should:

- create a directory to host your sites, out of /var/www/html/ (eg: /HTTPD_VHosts)
- create a subdirectory for each vhost (eg: /HTTPD_VHosts/site1, /HTTPD_VHosts/site2,
/HTTPD_VHosts/site3, etc)
- for each vhost subdirectory create a subdirectory for logs and anoter for the contents to be published
(eg: /HTTPD_VHosts/site1/logs, /HTTPD_VHosts/site1/htdocs, /HTTPD_VHosts/site2/logs,
/HTTPD_VHosts/site2/htdocs, /HTTPD_VHosts/site3/logs, /HTTPD_VHosts/site3/htdocs)
- create a subdirectory for configuration files common to different sites (eg: /HTTPD_VHosts/common_config)

At this point, your directory and file layout should be similar to this one:
HTTPD_VHosts
??? common_config
?   ??? php7.0-fpm.conf
?   ??? php7.2-fpm.conf
??? site1
?   ??? htdocs
?   ?   ??? index.php
?   ??? logs
?   ??? access_log
?   ??? error_log
??? site2
?   ??? htdocs
?   ?   ??? index.php
?   ??? logs
?   ??? access_log
?   ??? error_log
??? site3
??? htdocs
?   ??? index.php
??? logs
??? access_log
??? error_log


For each vhost, create a configuration file, to avoid confusion, name it with the same name of your
main site (eg: vh_site1.conf, vh_site2.conf, vh_site3.conf). You can put them into /etc/httpd/conf.d for automatical inclusion. IMPORTANT: REMEMBER to remove everything you don't need from /etc/httpd/conf.d/ or it will be included automatically! For example, absolutely remove /etc/httpd/conf.d/rh-php7?-php-fpm.conf !

VHost configuration files should be similar at least to something like this:

<VirtualHost *:80>
ServerName site1
DocumentRoot /HTTPD_VHosts/site1/htdocs

ErrorLog /HTTPD_VHosts/site1/logs/error_log
CustomLog /HTTPD_VHosts/site1/logs/access_log combined

# Include this one if you want PHP 7.0 for this site
Include /HTTPD_VHosts/common_config/php7.0-fpm.conf

# Include this one if you want PHP 7.2 for this site
# Include /HTTPD_VHosts/common_config/php7.0-fpm.conf

DirectoryIndex index.html index.php

<Directory "/HTTPD_VHosts/site1/htdocs">
Options none
AllowOverride all
Require all granted
</Directory>
</VirtualHost>

I already told you how to write /HTTPD_VHosts/common_config/php7.0-fpm.conf and /HTTPD_VHosts/common_config/php7.2-fpm.conf. Please go back and read my last email for that.

Feel free to change directories and names but don't mess with your path and filenames.
Also, check file permissions (apache httpd process need to read them, access directories and write logs).
Good luck friend.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Related question on having multiple subdomains on one host [ In reply to ]
On 04/09/2021 05:59 PM, Jonathon Koyle wrote:
> Do reach of your virtual hosts have a unique ServerName? x.x.x.x is not a very descriptive example.

No, they all had just the external IP address where I put x.x.x.x.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Related question on having multiple subdomains on one host [ In reply to ]
On 04/09/2021 03:50 PM, H wrote:
> I have been trying to configure running both php 7.0 and 7.2 on one host, certain sites using the former and others the latter. That's another thread though.
>
> However, I have some more questions given that my configuration is x.x.x.x/site1, x.x.x.x/site2 etc, I have separate conf files in /etc/httpd/conf.d/, one for each of site1, site2 etc, using this format:
>
> <VirtualHost *:80>
>         ServerAdmin xxxx
>         ServerName x.x.x.x
>         DocumentRoot /var/www/html/
>         Include /etc/httpd/conf.d/rh-php70-php-fpm.conf
>         ErrorLog /var/log/httpd/site1-error.log
>         CustomLog /var/log/httpd/site1-access.log combined
> </VirtualHost>
>
> The above is for x.x.x.x/site1, the others are similar except using site2 etc etc. The sites are in /var/www/html/site1, /var/www/html/site2 etc.
>
> - Is this the correct format? Ie, I shall have one <VirtualHost *:80> in each of those files? Or, does this need to be configured differently?
>
> - I want to log x.x.x.x/site1 errors to its own file, site1-error.log, and all accesses to site1 to its own file, the customlog file above. Site2 should be logged to its files etc. Yet I seem to end up with logentries for different subsites in the files which makes me suspect something is incorrectly configured...
>
>
For some reason I can get either php version to work but not both in parallel. Looking at other webpages referencing Ubuntu, it seems that one needs to enable being able to use multiple php versions in apache using a2enmod or something like that?

Is this required in CentOS as well?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Re: Related question on having multiple subdomains on one host [ In reply to ]
> On 04/09/2021 03:50 PM, H wrote:
> I have been trying to configure running both php 7.0 and 7.2 on
> one host, certain sites using the former and others the latter.


While you say you need to run both php 7.0 and 7.2 I don't see that
you have explained why.

I scanned through the changelogs from 7.2.0 back to 7.0. I may have
missed something but nothing popped out as breaking backwards
compatibility between 7.2 to 7.0. [.actually, i think that there is
one backwards incompatible change, but it's security-related so if
it's in older PHP code that code should be updated.]



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Re: Related question on having multiple subdomains on one host [ In reply to ]
On 04/09/2021 09:45 PM, Richard wrote:
>
>
>> On 04/09/2021 03:50 PM, H wrote:
>> I have been trying to configure running both php 7.0 and 7.2 on
>> one host, certain sites using the former and others the latter.
>
> While you say you need to run both php 7.0 and 7.2 I don't see that
> you have explained why.
>
> I scanned through the changelogs from 7.2.0 back to 7.0. I may have
> missed something but nothing popped out as breaking backwards
> compatibility between 7.2 to 7.0. [.actually, i think that there is
> one backwards incompatible change, but it's security-related so if
> it's in older PHP code that code should be updated.]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
You are correct, I had not. I need to run various web applications that have been compatibility tested with various databases, various versions of php etc. It is not possible for me to test if their requirements are overly restrictive or not with regard to eg php version (or database version for that matter), I simply need to go with the recommended configurations.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Related question on having multiple subdomains on one host [ In reply to ]
For a ’test’ environment I agree with advice given. Just because something can be done, doesn’t mean it should be. Running two versions of php on one server as I understand it, is only going to cause headaches and ’straighten the roundness of wheels to make them more square’… For test purposes it’s far better to use a professional version of MAMP. There are several versions of MAMP to suit various OS. https://www.mamp.info/en/windows/ <https://www.mamp.info/en/windows/>

PS I am not on commission for MAMP but if MAMP want to pay for my next holiday, they’re welcome :)

> On 10 Apr 2021, at 16:37, H <agents@meddatainc.com> wrote:
>
> On 04/09/2021 09:45 PM, Richard wrote:
>>
>>
>>> On 04/09/2021 03:50 PM, H wrote:
>>> I have been trying to configure running both php 7.0 and 7.2 on
>>> one host, certain sites using the former and others the latter.
>>
>> While you say you need to run both php 7.0 and 7.2 I don't see that
>> you have explained why.
>>
>> I scanned through the changelogs from 7.2.0 back to 7.0. I may have
>> missed something but nothing popped out as breaking backwards
>> compatibility between 7.2 to 7.0. [.actually, i think that there is
>> one backwards incompatible change, but it's security-related so if
>> it's in older PHP code that code should be updated.]
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
> You are correct, I had not. I need to run various web applications that have been compatibility tested with various databases, various versions of php etc. It is not possible for me to test if their requirements are overly restrictive or not with regard to eg php version (or database version for that matter), I simply need to go with the recommended configurations.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>