Hello,
I’d like there is a default config for every NameVirtualHost, so for every shared IP.
Indeed, yet if you try to get the page web from a shared IP it is the first VirtualHost that is shown. The same problem applies for user_dir directive. If you acced to http://01.02.03.04/~account/ then, as Apache doesn’t know which domain you try to get, all logs will go the first Vhost for this IP. More some times the public_html dir doesn’t work on a shared IP depending on the config of the first vhost xonfig file for this vhost
The inconvenient might be if you disable for exemple the first vhost of an IP. Thois client didn’t pay you so you disable his account. If someone go to http://01.02.03.04 (the shared ip of this account) then he will see a page telling him the site is disabled.
Etc, etc…
The solution seems to be easy. We should create a default VirtualHost like :
0000default.conf
In this virtualhost config we should add a <VirtualHost IPADRESS:80> for every shared IP and add the default server DocumentRoot (/var/www/html) and define the logs location
For exemple. Say we have 3 shared IP : 200.01.02.01, 200.01.02.02, 200.01.02.10
We should add in the 0000default.conf vhost config file
<VirtualHost 200.01.02.01:80>
DocumentRoot /var/www/html
General setup for the virtual host
ErrorLog /etc/httpd/logs/error_log
TransferLog /etc/httpd/logs/access_log
</VirtualHost>
<VirtualHost 200.01.02.02:80>
DocumentRoot /var/www/html
General setup for the virtual host
ErrorLog /etc/httpd/logs/error_log
TransferLog /etc/httpd/logs/access_log
</VirtualHost>
<VirtualHost 200.01.02.10:80>
DocumentRoot /var/www/html
General setup for the virtual host
ErrorLog /etc/httpd/logs/error_log
TransferLog /etc/httpd/logs/access_log
</VirtualHost>
This way
- all requests to http://200.01.02.01-02 or .10 will be served by the default index.html in /var/www/html
- All requests to http://200.01.02.01[02,10]/~account/ will be served by the public_html dir from the account, but all logs will go in the default /var/log/httpd/error_log
- etc
Maybe I explain bad, maybe you don’t understand what I’m talking about, but I’m sure if you already have this kind of problems then you know what I’m talking about.
Basicly it should be very easy for the control panel to just create a default config file when it is installed and then just add these lines every time we set an IP as shared (exactly as it does with the file namevirtualhost.conf )
Pascal