9 aprile 2021 21:51, "H" <[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]