obsd web server

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

obsd web server

Gustavo Rios
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

--
Pag Bem Fácil Ltda
www.pagbemfacil.com.br

Reply | Threaded
Open this post in threaded view
|

Re: obsd web server

Michael Hekeler
Hi gustavo,

my own expirience with this list is that you will receive very good
answers and tips from experienced people.
...but only if you try to ask good questions ;-)

With "good questions" I mean for example writing about what you want to
do, what you have done by now, what is not working, giving filenames,
errormessages, logfiles...

  - and of course asking a question ;-)
 
Because in your mail you have failed to tell what you have tried so far.
You didn't telll us what you expect and what failed or what errormessage
you receive. And - maybe I read wrong - there is no specific question in
your mail.

If you fix the above, I will be sure that someone will jump in and help






On Sun, Sep 01, 2019 at 08:49:45PM -0300, 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
>
> --
> Pag Bem Fácil Ltda
> www.pagbemfacil.com.br
>

--
Viele Grüße
Michael

Reply | Threaded
Open this post in threaded view
|

Re: obsd web server

Nick Holland
In reply to this post by Gustavo Rios
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.

Reply | Threaded
Open this post in threaded view
|

Re: obsd web server

Stuart Henderson
In reply to this post by Gustavo Rios
On 2019-09-01, Gustavo Rios <[hidden email]> wrote:

> 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.

With nginx you can do e.g.

        root            /sites/$http_host/htdocs;
        access_log      /sites/$http_host/logs/access.log  main;

Apache httpd has a similar method (see the manual about "Mass Virtual
Hosting").

httpd in the base OS does not support this.


Reply | Threaded
Open this post in threaded view
|

Re: obsd web server

Gregory Edigarov-5
In reply to this post by Gustavo Rios

On 02.09.19 02:49, 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

Hi,

you may want to look at lighttpd.
https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModSimpleVhost

should be what you need