Default VirtualHost for ip based name

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

Pascal,

We fully share your thoughts and to be honest, have a request in on our tracker at the moment to look at this, albeit it not very high priority.

I’m trying to understand what you are asking for? Are you asking for Interworx to auto-create this extra config for every IP Added to the system?

I too would like to see a bit more ‘control’ over that area of the apache serving, and what you have suggested seems to be a good solution :slight_smile:

Regards,
William

I’m trying to understand what you are asking for? Are you asking for Interworx to auto-create this extra config for every IP Added to the system?

I’m asking for :

  • The control panel create a file named 0000default.conf when it (the CP) is installed
  • The control panel add these config lines in this files every time we define an IP as a shared one. And remove these lines every time we change an IP from shared to dedicated
  • The control panel to give us the ability to define the default path of this docroot, and default path for those logs but let by default the one Apache use

Pascal

Sound very reasonable requests, and ones which I’m sure not just us would be interested in an answer to :slight_smile:

Cheers,
William

Pascal, this is a very good idea, and fairly easy to implement. No guarantees yet but I’m taking a serious look into this. Thanks for the post :slight_smile:

Paul

[QUOTE=IWorx-Paul;10785]Pascal, this is a very good idea, and fairly easy to implement. No guarantees yet but I’m taking a serious look into this. Thanks for the post :slight_smile:

Paul[/QUOTE]

ouahou !!! Very proud to see the best Tech guy I know find this idea very good :wink:
Oups… in fact all iworx guys are best tech (lol I manage susceptibilities)

Joke a part, seriously, I’m very pleased to read you Paul, the last time was maybe one and half or two years ago :stuck_out_tongue:

Pascal

Hello,

In fact in the 0000default.conf file we also have to add the rewrite rules about siteworx and nodeworx. If not a link like http://100.110.120.01/siteworx won’t work

so something like this works fine

<VirtualHost 100.110.120.01:80>

DocumentRoot /var/www/html

setup the basic redirects

RewriteEngine on
RewriteRule ^/siteworx(/)?$ https://%{HTTP_HOST}:2443/siteworx/?domain=%{HTTP_HOST} [R,L]
RewriteRule ^/nodeworx(/)?$ https://%{HTTP_HOST}:2443/nodeworx/ [R,L]

General setup for the virtual host

ErrorLog /etc/httpd/logs/error_log
TransferLog /etc/httpd/logs/access_log
</VirtualHost>

Pascal

Hello Pascal,

Just a thinkin out loud, but wouldn’t this line:

RewriteRule ^/siteworx(/)?$ https://%{HTTP_HOST}:2443/siteworx/?domain=%{HTTP_HOST} [R,L]

Be better without the ?domain= part as if its redirecting from an IP, it’ll put the IP into the domain box of the siteworx login page, which isn’t going to work for anyone as no-one has a SW account as an IP Address… maybe just:

RewriteRule ^/siteworx(/)?$ https://%{HTTP_HOST}:2443/siteworx/ [R,L]

Regards,
William

absolutly right

Pascal

[QUOTE=IWorx-Paul;10785]Pascal, this is a very good idea, and fairly easy to implement. No guarantees yet but I’m taking a serious look into this. Thanks for the post :slight_smile:

Paul[/QUOTE]

Hi,

Paul or Socheat will this feature be added soon (a minor realease of the v3 release) ?

Pascal

up this thread :slight_smile:

[QUOTE=IWorx-Paul;10785]Pascal, this is a very good idea, and fairly easy to implement. No guarantees yet but I’m taking a serious look into this. Thanks for the post :slight_smile:

Paul[/QUOTE]

is there chances this will be added in a minor V3 release ?

Pascal

[QUOTE=pascal;13304]is there chances this will be added in a minor V3 release ?

Pascal[/QUOTE]

Yes, there is a chance. :slight_smile: