Created
October 12, 2023 15:21
-
-
Save rawars/240da8f9d7d479b63def3cddee6c95cb to your computer and use it in GitHub Desktop.
Template balanceador de carga nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
user www-data; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
upstream backend { | |
server 127.0.0.1:7000; | |
server 127.0.0.1:5000; | |
# Agregar otros servidores aquí si es necesario | |
} | |
server { | |
root /var/www/html; | |
index index.html index.htm index.nginx-debian.html; | |
server_name 127.0.0.1; # Nombre del servidor para localhost | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $host; | |
proxy_pass http://backend; # Usar el grupo de servidores | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
listen 8000; | |
} | |
# Puedes agregar otros servidores o configuraciones aquí si es necesario | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment