Forum Archive - Gtranslate Pro + Nginx

Gtranslate Pro + Nginx
Nov 6, 2013 8:40 pm by mparkmed
Hello, could anyone help me (post code) with correct nginx settings for gtranslate redirections and the other rules? Thank you so much. Mark
Re: Gtranslate Pro + Nginx
Nov 6, 2013 8:53 pm by mparkmed
This is my nginx settings, so where could I put the right gtranslate rules? server { listen 80; server_name mydomain.eu; access_log off; error_log /var/log/nginx/mydomain.eu.error_log; return 301 $scheme://www.mydomain.eu$request_uri; } server { listen 80; server_name www.mydomain.eu; access_log /var/log/nginx/mydomain.eu.access_log; error_log /var/log/nginx/mydomain.eu.error_log; root /home/mydomain/public_html; location ~* \.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$ { deny all; } location / { root /home/mydomain/public_html; index index.html index.htm index.php; # this serves static files that exist without running other rewrite tests if (-f $request_filename) { expires 30d; break; } # this sends all non-existing file or directory requests to index.php if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; } gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css application/xml application/x-javascript image/png; } location /nginx_status { stub_status on; access_log off; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9001; # port where FastCGI processes were spawned fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/mydomain/public_html$fastcgi_script_name; # same path as above include fastcgi_params; fastcgi_read_timeout 360; fastcgi_send_timeout 360; client_max_body_size 20m; } } Gtranslate rules? from http://gtranslate.net/forum/nginx-wordpress-gtpro-t866.html#p3551 rewrite ^/([a-z][a-z])/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 last; rewrite ^/([a-z][a-z])$ /gtranslate/translate.php?lang=$1 last; rewrite ^/(zh-CN)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 last; rewrite ^/(zh-CN)$ /gtranslate/translate.php?lang=$1 last; rewrite ^/(zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 last; rewrite ^/(zh-TW)$ /gtranslate/translate.php?lang=$1 last;
Re: Gtranslate Pro + Nginx
Nov 6, 2013 8:56 pm by Edvard
Hi, Please set the rules before "# this sends all non-existing file or directory requests to index.php" line in your config. Thank you!
Re: Gtranslate Pro + Nginx
Nov 6, 2013 9:06 pm by Edvard
Here are the latest rules for Nginx: rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /$1/$3 permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$" /$1/ permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /gtranslate/translate.php?lang=$1&url=$2 last; rewrite "^/([a-z]{2}|zh-CN|zh-TW)$" /gtranslate/translate.php?lang=$1 last;
Re: Gtranslate Pro + Nginx
Nov 6, 2013 10:12 pm by mparkmed
ok, it wrote me this error: directive "rewrite" is not terminated by ";" in /etc/nginx/vhosts/cabinprague.eu.conf:24 nginx: configuration file /etc/nginx/nginx.conf test failed root@node01:~#
Re: Gtranslate Pro + Nginx
Nov 6, 2013 10:20 pm by mparkmed
I used this tool http://winginx.com/htaccess and the resulting code should be: rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /$1/$3 redirect; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$" /$1/ redirect; if (!-e $request_filename){ rewrite "^/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /gtranslate/translate.php?lang=$1&url=$2 break; } rewrite "^/([a-z]{2}|zh-CN|zh-TW)$" /gtranslate/translate.php?lang=$1 break; but still doesnt working, it try download the page instead translate, you can try it here myself: http://cabinprague.eu/
Re: Gtranslate Pro + Nginx
Nov 6, 2013 10:25 pm by mparkmed
Here are the latest rules for Nginx: rewrite ^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 permanent; rewrite ^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ permanent; rewrite ^/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 last; rewrite ^/([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 last; ok, in your code missing quotes: rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /$1/$3 permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$" /$1/ permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /gtranslate/translate.php?lang=$1&url=$2 last; rewrite "^/([a-z]{2}|zh-CN|zh-TW)$" /gtranslate/translate.php?lang=$1 last; but still doesnt working, it attempts to download the page instead of translation
Re: Gtranslate Pro + Nginx
Nov 6, 2013 10:28 pm by mparkmed
There is my phpinfo() http://cabinprague.eu/gtranslate/info.php
Re: Gtranslate Pro + Nginx
Nov 7, 2013 8:26 am by Edvard
Hi, Can you try to place the rules below before "location / {" line? rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /$1/$3 permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$" /$1/ permanent; rewrite "^/([a-z]{2}|zh-CN|zh-TW)/(.*)$" /gtranslate/translate.php?lang=$1&url=$2 last; rewrite "^/([a-z]{2}|zh-CN|zh-TW)$" /gtranslate/translate.php?lang=$1 last; If possible you can give me SSH access, so I can reconfigure and reload your nginx server. Thank you!
Re: Gtranslate Pro + Nginx
Nov 7, 2013 10:08 am by mparkmed
Give me your email please, I dont see here any tool for private messages, thank you.
Re: Gtranslate Pro + Nginx
Nov 7, 2013 11:21 am by Edvard
Please send to [email protected]. Thank you!

SIMILAR TOPICS

Gtranslate MultisiteFeb 12, 2019 7:27 amReplies: 1Post by: infact_dat
Gtranslate: Error with numberFeb 20, 2019 1:20 amReplies: 1Post by: infact_dat
GTranslate 3.7.4, Joomla 3.9.3 - doGTranslate is not definedFeb 22, 2019 12:34 pmReplies: 1Post by: oase
Add-on gtranslate no longer worksFeb 2, 2019 6:01 amReplies: 1Post by: DarylDixon
Nginx 502 ErrorJan 11, 2019 2:15 pmReplies: 1Post by: mightyfineprint

Try GTranslate with a free 15 day trial