tulpafred
Posts: 2
Joined: Sun May 05, 2019 7:31 pm

Raspberri Pi as webserver gateway

Sun May 05, 2019 7:54 pm

Hello everyone,

i have a question:
I have a few devices located in my LAN, that host a website. I own a domain, which allows me to create multiple A-Records.
Is it possible, to use the Raspi as a sort of webserver gateway, that can distribute HTTP (or HTTPS)-requests?

For example:

Server 1 hosts a website.
Server 2 hosts a website.

I can access the website of Server 1 via port forwarding. My router forwards requests on port 443 to Server 1. This way, I can't access the websites of both Servers from WAN, only the website of server 1.

I know from (expensive) business firewalls (such as Sophos devices), that it is possible to redirect these requests to different servers based on URL-specific forwarding.

Requests to "server1.mydomain.com" are forwarded to server 1 and requests to "server2.mydomain.com" are forwarded to server 2.
Both A-Records point to the same public IP of my router. In th background, the requests are forwarded to the raspberry, which decides, if the target is server 1 or server 2.

Does anyone know, if this is possible with an open source software, that runs on a raspberry model b+?

Thank you.

User avatar
procrasty
Posts: 3
Joined: Thu Dec 10, 2015 12:45 pm

Re: Raspberri Pi as webserver gateway

Wed May 08, 2019 7:40 am

This is a tutorial I followed a while ago, when seeking to do something similar... This build involves setting up an webserver gateway using Apache, PHP and mySQL and then port forwarding through the assignment of static IPs... Worked on my Raspi 2 setup... Should work on yours as well...

https://maker.pro/raspberry-pi/projects ... web-server
Noob. Has had a couple of Pi 2b+ boards for a couple of years. Looking to do more than set up Kodi media centres :)

tpyo kingg
Posts: 537
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: Raspberri Pi as webserver gateway

Wed May 08, 2019 7:51 am

If you can have the sites all on the same machine you could just use name-based virtual hosts and have the web server sort things out. That would be easiest by far.

Otherwise, I would look at nginx's proxying / load balancing capabilities.

tulpafred
Posts: 2
Joined: Sun May 05, 2019 7:31 pm

Re: Raspberri Pi as webserver gateway

Wed May 08, 2019 7:34 pm

Thanks for the replies.

I think, i will try my luck with the nginx server.
I found my tuts with LetsEncrypt plugin. So i can secure the connections with valid ssl certificates.

Thank you.

Return to “Networking and servers”