DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd November 2014
EverydayDiesel EverydayDiesel is offline
Shell Scout
 
Join Date: Jan 2009
Posts: 124
Default Hosting Two Websites With One IP - DNS Question

Hello, I would host 2 websites on a single ip address but I am not sure how to configure the rules for something like this

Lets say that I have two sites
1. www.website1.com
2. www.website2.com

And I have 4 machines
1. Openbsd Router/pf
2. Web server 1 running apache
3. Web server 2 running apache
4. DNS server


How do I filter traffic from the WWW address to the specific webserver?

I assume that the DNS will need to resolve the www address to an internal IP on my network and then the fw/nat would then route it to the correct machine.

the setup would look similar to this?

External internet --> Openbsd Firewall --> DNS --> ???

Thanks in advance
Reply With Quote
  #2   (View Single Post)  
Old 3rd November 2014
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Two separate web servers, rather than a single server with virtual hosts? In that case you may find relayd(8) helpful.
Reply With Quote
  #3   (View Single Post)  
Old 4th November 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by jggimi View Post
Two separate web servers, rather than a single server with virtual hosts? In that case you may find relayd(8) helpful.
You know infintelly more than me but in this case I would not go so fast with relayd. Also OP should do little bit reading before asking question as it is obvious that she/he is quite confused with many things.

This the thead which I started and personally finished with this configuration file for Nginx.

Code:

# $OpenBSD: nginx.conf,v 1.16 2014/01/28 14:48:53 stephan Exp $

#user  www;
worker_processes  4;

#syslog     local5          nginx;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#error_log  syslog:notice|logs/error.log;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    index         index.html index.htm;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    #access_log  syslog:notice|logs/access.log main;

    #tcp_nopush     on;

    keepalive_timeout  65;

    server_tokens off;

    # Virtual hosts 
    server { 
        listen       myIP:80;
        server_name  www.test.org;
        location /www1 { 
            proxy_pass http://www1.int.test.org;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_redirect off;
            proxy_buffering off;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            }
        location /www2 {
            proxy_pass http://www2.int.test.org;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_redirect off;
            proxy_buffering off;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    }

}
Now if you read thread you will see that the second the last person posting will be Reyk who is announcing that the feature I was looking for was added to the relayd. However the post after Reyk's which came almost 2 months latter reveales that the feature actually doesn't work as advertised.


My verdict is that OP should read Nginx man pages and check the configuration file I just posted and try to understand it.
Reply With Quote
  #4   (View Single Post)  
Old 4th November 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

You could also read about the different approaches for virtual hosts in Wikipedia.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS Hosting DraconianTimes Off-Topic 3 29th September 2009 11:01 PM
Hosting a webpage for free in internet. bsdnewbie999 Off-Topic 7 12th April 2009 02:38 PM
open source web hosting control panel's crayoxide General software and network 2 28th September 2008 11:42 PM
Hostname / web hosting issues vitiate FreeBSD General 4 20th May 2008 02:23 PM


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick