Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
неработают rewrite
- To: nginx-ru@xxxxxxxxx
- Subject: неработают rewrite
- From: "t4gs" <nginx-forum@xxxxxxxx>
- Date: Fri, 11 Apr 2014 03:12:19 -0400
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=selenium.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=Rz0yAhzYBqZfMff9zGWZV5K/nQuGJVwM4s4Yx1+yAyk=; b=es8Etgm8JQXCglTzVfSWBwxlt4SLsoHLFIYW/frHgQdnomzR7DNHCk6tCdSnm4s52MhTukWyAnVy/F472FAcwCpaYMykNfoPdg22m98Un43XaFl6MSN3mDuyagVU98SwGw9ikKaM6zy3bn6m/hOmDuNA4Q5+Vh8zRkcw7RBeUsc=;
Доброе время суток.
После переезда на nginx/1.1.19 + php-fpm неработают правила rewrite.
до этого был .htaccess следующего содержания :
RewriteEngine On
RewriteCond %{HTTP_REFERER} .*google.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*bing.*$ [NC]
RewriteCond %{HTTP_USER_AGENT} Chrome [NC]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(US|CA) [NC]
RewriteCond %{HTTP:Accept-Language} (en|es) [NC]
RewriteRule .* http://site/ [R,L]
После конвертации получился следующий конфиг:
server {
# host IP and port
listen 80;
# domain name
server_name site.com www.site.com;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
# home directory
root /opt/WWWRoot/site;
location / {
charset utf-8;
index index.php index.html;
rewrite_log on;
if ($http_referer ~* ".*google.*$"){
set $redir $1;
break;
}
if ($http_referer ~* ".*bing.*$"){
set $redir $1;
break;
}
if ($http_user_agent ~* "Chrome"){
set $redir $1;
break;
}
if ($geoip_country_code ~* "(US|CA)"){
set $rule_0 1;
break;
}
if ($http_accept_language ~* "(en|es)"){
set $redir $1;
break;
}
if ($redir = $1){
rewrite /.* http://site2.com redirect;
}
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
# for PHP-FPM over socket
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
fastcgi_intercept_errors on;
}
}
Помогите пожалуйста сделать нормальный рабочий конфиг.
Заранее спасибо.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,249217,249217#msg-249217
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|