Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2004
    Posts
    261

    Apache: How to add domain without restarting

    We are moving to a new server and was wondering if it would be better to use Apache 1.3 instead of Apache 2? Meaning are there any "plugins" for Apache 1.3 that would allow to add domains to apache without restarting it and from a "GUI"?

    I wanted to write a script via php to allow users to add domains via a web based gui. I can use MyDNS for the DNS entries, but you still need to add it to Apache config file right?

    Thanks
    Silly

  2. #2
    Join Date
    Nov 2004
    Posts
    261
    To explain it a little better, isnt there a plugin to administrate apache via a database like mysql? If so is it for Apache 1.3 or 2?

    Thanks
    Silly

  3. #3
    Join Date
    Oct 2005
    Location
    Quebec
    Posts
    60
    I know you can issue a kill -USR1 and this will restart apache. This will restart the apache server gradually, as soon as a pid is done serving it's request it will re-read the configuration and then be ready to serve more without killing current connections. If you script something in php you might want to consider this.

  4. #4
    Join Date
    Nov 2004
    Posts
    261
    After doing a little research I can better ask the question. I want to administrate domain names. Is there a mod in Apache that will store the domain names in mysql so that the user can login and administrate their domains via a gui instead of me manually having to add their domain to the httpd.conf file?

    If so, do I still have to restart Apache in order for the changes to take affect? If I do have to restart Apache, is there a way to do it from a script instead of me logging into the server and manually restarting it?

    Thanks
    Silly

  5. #5
    Join Date
    May 2004
    Location
    Hungary
    Posts
    106
    If the subdomain is the same as a subfolder in the user's home folder, you can make subdomains that will automatically display the content of the corresponding folder (eg. test.domain.com points to the test folder). This way you (or cron) don't have to restart Apache.

    If you want a GUI, you can e.g. write a PHP scripts that edits your httpd.conf and a cron daemon checks the modification time and restarts Apache, if needed.

  6. #6
    Join Date
    Nov 2004
    Posts
    261
    Hmm. I found a mod that supposidly stores everything in a database and doesnt require a restart. I originally was going to use sqlinclude mod, but that still required a reboot. I was thinking of just using a cron to do a graceful everynight to make all changes go into affect. But then I found this links:

    http://www.crazygreek.co.uk/content/mod_shapvh

    Anyone have any experience with this mod?

    Thanks
    Silly

  7. #7
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    14,135
    There really isn't a way to add something to apache without "restarting". Anything claiming this is quite off.. Unfortunately, it's just not a feasible or possible solution, and here's why.

    Apache must be physically told where to look for certain things, how to long some things, how to handle ssl redirects for domains, subdomains, etc. It looks for all of this in the configuration files, not a database, or something else.

    Realistically, restarting apache takes about 5 seconds, seriously, so why even worry about restarting it? It's not like it takes 5 minutes , restarts the entire server, thusly affecting ftp, email, etc. It's apache, it restarts quickly and effectively.
    Tom Whiting, WHMCS Guru extraordinaire
    Linux problems? WHMCS Problems? Give me a shout
    Check out my WHMCS Addons

  8. #8
    Join Date
    Dec 2004
    Location
    New York City, NY, USA
    Posts
    735
    Just to point out what I think is a superior strategy... Why not write out new Apache configuration files every time someone adds a domain? You can then use the USR1 signal (typically simplified on most distributions with `/etc/init.d/apache reload`) to force Apache to reload configuration files.

    Apache is already an extremely complex piece of software; having it depend on another complex relational database software is just asking for trouble.

  9. #9
    Join Date
    Aug 2005
    Location
    Canada
    Posts
    862
    I found a few of them, the other day.

    http://www.outoforder.cc/projects/apache/mod_vhost_dbi/
    http://www.oav.net/projects/mod_vhs/

    Personally, I think it's better to avoid MySQL, though ...
    I've been thinkgin about modified mod_vhost_alias, or something like that.

  10. #10
    Maybe I'm missing something but why don't you just use dynamic virtual hosts?

    Code:
    NameVirtualHost *:80
    <VirtualHost *:80>
      VirtualDocumentRoot /usr/local/www/data/vhosts/%2+
    </VirtualHost>
    Using that all you have to do is create a directory named "/usr/local/www/data/vhosts/domain.com", place the files for domain.com com in that directory, and viola, it's good to go. No need to do anything with Apache, add a database record, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •