On 9/1/19 5:49 PM, Gustavo Rios wrote: > Hi folks, > > i would like to confgiure my obsd server as a web server. > > I would like to configure my web server to handle multiple domains > without having to set each domain one by one. > > I mean: > Every request for www.x.com is mapped into the root directory > /var/web/www.x.com > > Got the idea ? If a new server is required, All i needed to do would > create a directory inside /var/web with the full access string : > > mkdir /var/web/www.newdomain.com > > And i should not need to manipulate config files. > > Thanks in advance I don't think that's doable as you request, nor do I think it is a noble goal. , Unless you have a really really unusual use case, you will have per-site specific settings -- for example, HTTPS certificates.
HOWEVER, with some trivial scripting, you can easily accomplish something that appears to be what you request. When you have a lot of similar things to manage, think scripts. :) Here's a primitive and untested concept: newweb: ======================== #!/bin/ksh mkdir -m755 /var/www/$1 chown (whomwever) /var/www/$1 cat >>/etc/httpd <<__ENDSITE server "$1" { alias "www.$1" listen on $ext_addr port 80 log style combined log access $1.access log error $1.error root /$1 } __ENDSITE /etc/rc.d/httpd reload ======================== Now, in real life, you would want to flesh out that config a bit more, and you would probably want to save a copy of the httpd.conf file, and check if httpd errored, and if so, restore the old copy. Lots of other error checking would be appropriate as well. You could also just do something more sophisticated, like create an httpd.d directory and create a template domain.conf file in there for each one, and just add an "include" line in your httpd.conf for each new domain. Now when you decide that all your domains are NOT just alike, you can easily rev the ones that are different. Nick.