Nginx Default Page on Load Balancer Instead of My Laravel Application - Stack Overflow

I have an issue: I have two droplets that are properly set up with Laravel, and everything works perfec

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信