mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/selfhosting-blogposts.git
synced 2025-05-17 12:47:01 +00:00
add selfhosting tutorials
This commit is contained in:
parent
95c33c8b41
commit
cc3824e6a2
1900 changed files with 32727 additions and 0 deletions
53
haproxy/index.md
Normal file
53
haproxy/index.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Haproxy setup
|
||||
|
||||
This one is done from proxmox, i used a debian10+ CT template to create the machines i needed.
|
||||
|
||||
## **Initial setup**
|
||||
|
||||
To start with, get 2 identical debian hosts with nginx on them:
|
||||
|
||||

|
||||
|
||||
My 2 servers will have the ips 192.168.0.151 and 192.168.0.150 meanwhile 192.168.0.152 is going to be our haproxy server.
|
||||
|
||||
_First server:_
|
||||
|
||||
|
||||
apt update -y && apt upgrade -y
|
||||
apt install nginx curl -y
|
||||
echo 'server number 1' > /var/www/html/index.nginx-debian.html
|
||||
ip a | grep inet #IP1
|
||||
|
||||
|
||||
|
||||
 _Second server:_
|
||||
|
||||
|
||||
apt update -y && apt upgrade -y
|
||||
apt install nginx curl -y
|
||||
echo 'server number 2 ' > /var/www/html/index.nginx-debian.html
|
||||
ip a | grep inet #IP2
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
Now that we have 2 servers running http, we're going to load balance them with a third debian machine with haproxy:
|
||||
|
||||
|
||||
apt update -y && apt upgrade -y
|
||||
apt install haproxy curl -y
|
||||
wget https://blog.nowhere.moe/servers/haproxy/haproxy.cfg -O /etc/haproxy/haproxy.cfg
|
||||
nano /etc/haproxy/haproxy.cfg
|
||||
systemctl restart haproxy
|
||||
ip a | grep inet #IP3
|
||||
curl 127.0.0.1
|
||||
|
||||
|
||||
|
||||
In nano, change the ips with the ips of your 2 debian servers (IP1 & IP2) and reload haproxy, then go and see if haproxy works (IP3)
|
||||
|
||||

|
||||
|
||||
You can reload haproxy's webpage multiple times, and you'll see that sometimes it is going to switch from one server to the other, therefore we successfully setup a simple load balancing with haproxy.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue