Welcome! Log In Create A New Profile

Advanced

Rewrite not work

September 02, 2012 02:58PM
Hello
i have problems with rewrite
upstream php_fpm_host {
server unix:/var/run/php-fpm/php-host.sock;
}
server {
listen xxx:80;
server_name xxx.xxx.xxx;
root /home/host/public_html;

access_log /home/host/a.log;
error_log /home/host/e.log;
client_max_body_size 20G;
location / {

index index.php;



rewrite "^/en/(.*)$" /$1.php?setlang=en last;

rewrite "^d=([a-zA-Z0-9]{8,12})$" /download.php?id=$1&type=1&$args last;
rewrite "^d=([a-zA-Z0-9]{12,16})$" /delete.php?id=$1&$args last;
rewrite ^/file/([0-9]+)/(.*)$ /download.php?id=$1&name=$2&type=2&$query_string last;
rewrite "^/([a-z]{2})/file/([0-9]+)/(.*)$" /download.php?setlang=$1&id=$2&name=$3&type=2 last;
rewrite ^/myfolders/([0-9]+)-(.*)$ /folders.php?fid=$1&name=$2&$query_string last;
rewrite "^/([a-z]{2})/myfolders/([0-9]+)-(.*)$" /folders.php?setlang=$1&fid=$2&name=$3&$query_string last;




rewrite "^/([a-z]{2})$" /?setlang=$1 last;
rewrite "^/([a-z]{2})/$" /?setlang=$1 last;


rewrite "^/([a-z]{2})/topfiles/$" /top.php?$query_string last;
rewrite ^/topfiles/$ /top.php last;

rewrite "^/([a-z]{2})/topfiles/$" /top.php?$query_string last;
rewrite ^/topfiles/index([0-9]*)\.html$ /top.php?s=$1&$query_string last;
rewrite "^/([a-z]{2})/topfiles/index([0-9]*)\.html$" /top.php?setlang=$1&s=$2&$query_string last;



rewrite ^/content/([0-9a-zA-Z]+)\.html$ /page_template.php?page=$1 last;
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass php_fpm_host;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location ~ ^/cgi-bin/.*\.cgi$ {



gzip off; #gzip makes scripts feel slower since they have to complete before getting gzipped
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
include /etc/nginx/fastcgi_params2;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/host/public_html/cgi-bin/;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}

location ~ /\.ht { deny all; }


}

}

scripts dosent work

2012/09/02 19:05:19 [error] 26962#0: *10664 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 178.37.86.205, server: host.xxx.pl, request: "GET /en/members.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-host.sock:", host: "xxx.xxx.pl", referrer: "http://xxx.xxx.pl/en"
2012/09/02 21:01:21 [error] 26962#0: *11120 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 84.10.140.166, server: xxx.xxx.pl, request: "GET /ru/flashvars.php?&r=631&UploadSession=e9483232eb0082f1ed7e969a5a53005c&AccessKey=RDk=&ServerID=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-host.sock:", host: "xxx.xxx.pl", referrer: "http://xxx.xxx.pl/ru/"
2012/09/02 21:01:27 [error] 26962#0: *11120 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 84.10.140.166, server: xxx.xxx.pl, request: "GET /ru/register.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-host.sock:", host: "host.xpx.pl", referrer: "http://xxx.xxx.pl/ru"

this is orginal htacesss

Options +FollowSymLinks

RewriteEngine on
##point to installation directory
##if it is the root dir,enter /
##else /otherdir
RewriteBase /

RewriteCond %{QUERY_STRING} ^d=([a-zA-Z0-9]{8,12})$
RewriteRule ^$ download.php?id=%1&type=1 [L]

RewriteCond %{QUERY_STRING} ^d=([a-zA-Z0-9]{12,16})$
RewriteRule ^$ delete.php?id=%1 [L]

RewriteRule ^file/([0-9]+)/(.*)$ download.php?id=$1&name=$2&type=2&%{QUERY_STRING} [L]
RewriteRule ^([a-z]{2})/file/([0-9]+)/(.*)$ download.php?setlang=$1&id=$2&name=$3&type=2 [L]
RewriteRule ^myfolders/([0-9]+)-(.*)$ folders.php?fid=$1&name=$3&%{QUERY_STRING} [L]
RewriteRule ^([a-z]{2})/myfolders/([0-9]+)-(.*)$ folders.php?setlang=$1&fid=$2&name=$3&%{QUERY_STRING} [L]

RewriteRule ^topfiles/$ top.php [L]
RewriteRule ^([a-z]{2})/topfiles/$ top.php?%{QUERY_STRING} [L]
RewriteRule ^topfiles/index([0-9]*)\.html$ top.php?s=$1&%{QUERY_STRING} [L]
RewriteRule ^([a-z]{2})/topfiles/index([0-9]*)\.html$ top.php?setlang=$1&s=$2&%{QUERY_STRING} [L]

RewriteRule ^([a-z]{2})$ ?setlang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/$ ?setlang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/(.*)\.php$ $2.php?setlang=$1 [QSA,L]

RewriteRule ^content/([0-9a-zA-Z]+)\.html$ page_template.php?page=$1 [QSA,L]

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
Subject Author Posted

Rewrite not work

Adrian Janeczek September 02, 2012 02:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready