Hey everyone. First-time poster, working on my third Kirby site. I’ve successfully built and deployed two sites; both were on NGINX servers. One was in a sub-folder. This is the first one that requires multi-lang, and I can’t figure out how to configure NGINX to route properly.
Here’s my NGINX config to route a single-language site properly within the sub-folder “kirbytest”:
# Kirby nginx configuration
location /kirbytest/content {
rewrite ^/kirbytest/content/(.*)\.(txt|md|mdown)$ /kirbytest/index.php;
}
location /kirbytest/site {
rewrite ^/kirbytest/site/(.*) /kirbytest/index.php;
}
location ~ ^/assets/(.*) {
return 301 /kirbytest/assets/$1;
}
location /kirbytest/ {
rewrite ^/kirbytest/(kirby|panel\/app|panel\/tests)/(.*) /kirbytest/index.php;
if (!-e $request_filename){
rewrite ^/kirbytest/panel/(.*) /kirbytest/panel/index.php;
}
if (!-e $request_filename){
rewrite ^/kirbytest/(.*) /kirbytest/index.php;
}
}
If I configure the default language to sit at the root / , this will still load the Home page. However, none of my other pages can be accessed, for any language. If I set the default English to /en , and Japanese to /jp , I can’t access any pages at all.
What am I missing to enable Kirby to route properly to /en and /jp folders? Can NGINX & Kirby even do this?
Now, on my local test server, I’m just running Apache at the server root, and I can access every page on /en and /jp. It’s only when deploying to my remote server, where the site unfortunately needs to live entirely inside a sub-folder, that the routing breaks.
Is it possible to do what I’m trying to do? The only server I can use to deploy is NGINX; and again, that’s worked fine with single-language in the past. I might eventually be able to deploy to a URL root, but maybe not. I’d like to get it working as-is. Ultimately I could run everything on an Apache server; but I’d rather not have to go through that!
Thank you to anyone who can offer any advice.