I have an issue: I have two droplets that are properly set up with Laravel, and everything works perfectly. The problem is that on a third droplet, I need to set up a load balancer, which I believe is configured correctly. However, the issue is that it doesn't display my Laravel applications; it only shows Nginx's default page. I have also deleted the default Nginx configuration file.
Here is the configuration for my Laravel droplets:
server {
listen 80;
server_name private ip droplet1;
access_log /var/log/nginx/server.access.log;
error_log /var/log/nginx/server.error.log;
root /home/fernando/www/loginSeguridad/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name private ip droplet2;
access_log /var/log/nginx/server.access.log;
error_log /var/log/nginx/server.error.log;
root /home/fernando/www/loginSeguridad/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
Load Balancer Droplet Configuration:
upstream backend {
ip_hash;
server private ip droplet1;
server private ip droplet2;
}
server {
listen 80;
server_name public ip droplet load balancer;
location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
I would appreciate your help with this. All the droplets are running on Rocky Linux.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744261771a4565668.html
评论列表(0条)