Hi,
I know this has been asked many times and there are various posts
addressing this but I'm struggling to find a concrete example, maybe my
approach is wrong but I'd appreciate some help.
So, I have a number of mojo applications, say app1, app2, appN, they all
work great when I spin them up with hypnotoad on their own ports, app1 runs
on 5000, app2 on 5001, appN 5..N. Can I put all these separate apps behind
Nginx and have Nginx serve the js/css content from the public folder for
each app on a single vhost? I have spent days trying to work this out so I
may be on completely the wrong track.
Here is my Nginx conf on my dev box for app1 and app2. I can't seem to get
Nginx to serve the static content from the public directory for each app,
it only works if I proxy all requests. I know this is more of a Nginx
question than Mojo specific but can anyone help please? What is the
recommended way to do this?
server {
listen 80 default_server;
listen [::]:80 default_server;
# Root for stuff like default index.html
root /var/www/html;
# location ~* /(images|css|js|files)/ {
# root /home/username/app1/public/;
# expires 7d;
# }
location /app1 {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
}
location /app2 {
proxy_pass http://127.0.0.1:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
}
location /appN {...}
}
I've also looked at Toadfarm to combine my apps into one but I'm concerned
about scalability, doesn't Toadfarm check each route until it finds a
match? If I have 15 mojo apps running how is this going to impact on
performance?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.