#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Apache directives via database


    Wondering if there is a way to house the configuration of an apache directive (i.e. directory, location, or virtualhost) in a mysql database?

    We are trying to build a webdav server that can be dynamically updated from a mysql database, where each user we define gets a webdav directory like this:

    <Directory /webdav/username1>
    Dav On
    Options +Indexes
    IndexOptions FancyIndexing
    AddDefaultCharset UTF-8
    AuthType Digest
    AuthName "Private"
    AuthUserFile ??
    Require user username1
    Order allow,deny
    Allow from all
    require valid-user
    </Directory>

    I know you can do authentication via a database using mod_auth_mysql, but we want to do the entire webdav configuration from a database. Is this even close to possible?
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    I don't believe so, no.

    But what you can do is create a file per user in a directory that has only these configuration files and then use the Include directive to get them all in to Apache's configuration when it's restarted.
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    In the same boat


    Hi, I'm looking at the same situation myself. A bit of googling hasn't turned up anything that will just plugin and do it all for me but it looks as if I can accomplish it with a wee bit of perl.

    See perl.apache.org/docs/2.0/user/handlers/http.html, in particular PerlAuthenHandler.
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    ispconfig3 does what you want. The ispconfig3 code is all php and open-source, you could get their package and see how they handle dynamic per-vhost apache directives.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain

IMN logo majestic logo threadwatch logo seochat tools logo