admin管理员组文章数量:1401849
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.
本文标签: Nginx Default Page on Load Balancer Instead of My Laravel ApplicationStack Overflow
版权声明:本文标题:Nginx Default Page on Load Balancer Instead of My Laravel Application - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744261770a2597750.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论