I'm trying to get a basic locals sub directory system working on Nginx:
/entry - en local. /fr/entry - french translation. /it/entry ect..
Having read this knowledge base article and some other forum posts I'm still having difficulties with 404 errors when following them or duplicate '/fr/fr'/entry issues.
Do I need to use duplicate index.php files with locals declared in them if I'm adding url paths in the section admin pages? What about site baseUrls in the config file?
The documentation seems very conflicting in these cases and having tried nearly every possible configuration option my site still won't serve up different locals.
I've had the most luck with this nginx config, together with specifying the local in the section urls in the cms for each section.
server {
listen 80;
server_name site.com;
root /sites/site/public;
index index.php;
client_max_body_size 30M;
location /en/ {
root /sites/site/public;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location /ru/ {
root /sites/site/public/ru;
if (!-e $request_filename) {
rewrite ^/(.*)$ /ru/index.php?q=$1 last;
}
}
location /zh/ {
root /sites/site/public/zh;
if (!-e $request_filename) {
rewrite ^/(.*)$ /zh/index.php?q=$1 last;
}
}
location / {
root /sites/site/public;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
}
location ~ /\.ht {
deny all;
}
}
(each index.php has its own set local var within it like so for fr):
// Path to your craft/ folder
$craftPath = '../../craft';
// Tell Craft to serve the local site
define('CRAFT_LOCALE', 'fr');
// Do not edit below this line
My General config is
<?php
/**
* General Configuration
*/
return array(
'siteUrl' => array(
'en' => 'http://www.site.com/',
'ar' => 'http://www.site.com/ar/',
'es' => 'http://www.site.com/es/',
'fr' => 'http://www.site.com/fr/',
'hu' => 'http://www.site.com/hu/',
'it' => 'http://www.site.com/it/',
'ru' => 'http://www.site.com/ru/',
'zh' => 'http://www.site.com/zh/',
),
'maxUploadFileSize' => 2147483647,
);
This results in the server displaying the correct links to my localised articles in the menu and the en language serves up entries correctly, however other languages are found at /local/local/entitypath not local/entitypath.
Adding site_urls to my config seems to break things more, causing locals to not be served up at all.