I have multisite settings on single instance, I mean using site id, I'm switching content, logo theme colors etc and I have different domain names for each site.
Paths
http://localhost:3000/{{site_id}}/
http://localhost:3000/{{site_id}}/about-us/
http://localhost:3000/{{site_id}}/product/1232/slug
etc...
For Example
http://localhost:3000/1 => site-a.local
http://localhost:3000/2 => site-b.local
http://localhost:3000/3 => site-c.local
I'm using nginx, reverse proxy from port 80 to 3000. How can I forward the site id in the nginx
server {
listen 80;
listen [::]:80;
server_name site-a.local;
location ~ /(.*) {
proxy_pass http://localhost:3000/1;
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;
}
}
server {
listen 80;
listen [::]:80;
server_name site-b.local;
location ~ /(.*) {
proxy_pass http://localhost:3000/2;
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;
}
}
The above idea is not working for some reason can someone help me?