Software development, photography, jokes, ....

noyb-logo

Sites by me

 
sds82-logo
tas-logoTransportation Administration System
snoezelkussen-logo-kleinstSnoezelen Pillows for Dementia
ikzoekeenbegeleider-logoBegeleiders voor gehandicapten
Laat uw hond het jaarlijkse vuurwerk overwinnen
Betuweroute en Kunst
logo 50x50Hey Vos! Je eigen naam@vos.net emailadres?
Kunst in huis? Nicole Karrèr maakt echt bijzonder mooie dingen
nettylogo2Kunst in huis? Netty Franssen maakt ook bijzonder mooie dingen

Hosting Favorites

 
ANU Internet Services
Netim
GoDaddy
XEL Media

Blogroll

 
Bomenstichting
Google Translate
PHP
MySQL
jQuery
jQuery UI
YourHead Stacks API
Favicon Generator.
Password Generator.
Check HTTPS problems


Marc's Place


 

 Apache VHOST sort order

  How create make sure your VHOSTs are in the right order.


I had this CentOS server; now I have a Fedora DRBD setup. And I mainly use Webmin to manage the settings. But creating virtual hosts is something different.



Buy me a drink

Webmin lists your virtual hosts in alphabetical order - and this is never the order in which the virtual hosts are stored in /etc/httpd/conf/httpd.conf, if you choose to do so.

apache-webmin-vhost-1

The virtual hosts are stored in order of entry. That is a bit of a pain and it’s a pity the Webmin interface does not work in the same way as the Webmin interface for the firewall rules; there one has these arrows on the right to move a rule up- or downwards in the list. Would be a cool thing to implement in the virtual host list too.

Anyway, Webmin does a good job if you store the virtual hosts in separate files - if you make modifications to a virtual host, it save the changes in the correct file.

apache-webmin-vhost-2

To manage your hosts like this and move them from the httpd.conf file into separate files, first create a folder /etc/httpd/vhosts and then create files for each vhost listed in http.conf. Copy/Paste each complete <VirtualHost></VirtualHost> block. When you are done, remove all virtual hosts from http.conf and add the following line of text:

Include vhosts/*.conf

Save and exit http.conf

You can now control the load order of the virtual hosts easily by beginning the file names with a number. Number the catch-all host the highest. Then check if you did a good job:

$ apachectl configtest

If all is OK, restart Apache:

$ apachectl graceful

Or, if you did it all via Webmin, click Apply changes at the top-right of the window of the Apache Webserver interface.

Another thing what I miss from Webmin’s virtual host overview is the name of the file where the virtual host is in. But you can see it if you click a virtual host’s name and then click 'Edit Directives':

apache-webmin-vhost-3

My list of vhosts looks like this:

$ ls -C1 /etc/httpd/vhosts

00awf-beeldendenklinkend.conf
00begeleider.conf
00bomeninfo.conf
00bszutphen.conf
00handidate.conf
00nicolekarrer.conf
00tradsys.conf
00voelkussen.conf
10snoezelen-pillow.conf
11snoezelen-kissen.conf
12coussin-calin.conf
19snoezelkussen.conf
20bobvosnet.conf
21ceesvosnet.conf
22daanvosnet.conf
23loesvosnet.conf
24marcvosnet.conf
29vosnet.conf
90sds82.conf


That’s it!


buy me something-2
© 1997- Marc Vos (and others)   -   Privacy Statement   -    Contact Me

On this website, Google Analytics is used to track visitor statistics. These are anonymised data about the number of visitors, which pages they visit on this site, from which regions they visit, which web browsers they use, etc.. You will also see non-personalised ads via Google AdSense. Cookies from Paddle or Paypal are placed when you click on a 'Buy now!' or 'Donate!' button, and possible cookies from Disqus when you use that system to comment on one or more blogposts.
Privacy Statement