I have Laravel application hosted with Laravel Forge behind the load balancer (example is on the image below), now I want to move my blog (WordPress) which is currently hosted under the subdomain to a subfolder from blog.example.com to example.com/blog Is there a way to configure the load balancer to redirect trafic coming to example.com/blog to a separate server with WP installed on it? Here is my current load balancer Nginx configuration I’ve tried to just add a new location to my load balancer Nginx configuration which will proxy_pass traffic to a WP installation but that returns a “502 bad gateway” error and it doesn’t work.
Nginx Conifiguration
`# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/before/*;
# FORGE CONFIG (DO NOT REMOVE!)
include upstreams/example.com;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com;
server_tokens off;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/example.com/1231231/server.crt;
ssl_certificate_key /etc/nginx/ssl/example.com/1231231/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
charset utf-8;
access_log off;
error_log /var/log/nginx/example.com-error.log error;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/server/*;
location / {
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;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://1231231_app/;
proxy_redirect off;
# Handle Web Socket Connections
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/example.com/after/*;`
I need suggestion Is that a good way to Implement the WordPress website in laravel?
Becauser we are using Load balancer, We will have different servers to split the traffic. So Laravel site is fine. But if we will have wordpress website we need to install it on all server we will use. Tell me if there will be a good approach to achieve this. Because Wordpress site when we will make any change on one side then it will be difficlt for us to make updates on different server for wordpress. How can we achieve this?
Thanks
