|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
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 |
|
||||
Two separate web servers, rather than a single server with virtual hosts? In that case you may find relayd(8) helpful.
|
|
||||
Quote:
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; } } } My verdict is that OP should read Nginx man pages and check the configuration file I just posted and try to understand it. |
|
|||
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 |
|
|
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 |