Skip to main content

Mise en place de NGINX

Tout d'abord, on l'installe.

apt install nginx -y

On modifie le fichier de configuration pour y inclure :

nano /etc/nginx/nginx.conf
http {
   upstream backend {
      server 192.168.199.50 weight=5 max_fails=3 fail_timeout=10s;
      server 192.168.199.51 weight=1 max_fails=3 fail_timeout=10s;
   }
  
   server {
      listen 80;
      server_name web.home.khroners.fr;

      location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_pass http://backend$request_uri;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_set_header Host web.home.khroners.fr;
      }
   }

On redémarre le service.

systemctl restart nginx