nginx, spawn-fcgi and php on freebsd - adding '/' incorrectly
khine
nginx-forum at nginx.us
Fri Feb 11 16:09:04 MSK 2011
hello,
i managed to get this almost working, but have another issue, in that
when i enable the friendly URL's from within the Back-Office of
Prestashop, all the links on this site are being rewritten back to the
home site.
[code]
server {
server_name dev.editionsdelga.fr;
root /www/editionsdelga.fr/prestashop;
access_log logs/editionsdelga.access.log main;
error_log logs/editionsdelga.error.log;
rewrite_log on;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
include prestashop.conf;
include php.conf;
}
[/code]
in the above snippet, the rewrite_log, does not seem to write anything
in the logs/editionsdelga.error.log file! is there a way to test the
rewrite rules for /usr/local/etc/nginx/prestashop.conf file?
[code]
# cat /usr/local/etc/nginx/prestashop.conf
rewrite
^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$
/img/p/$1-$2$3.jpg last;
rewrite ^/([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg
last;
rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$
/img/c/$1$2.jpg last;
rewrite
"^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$3&isolang;=$1$5" last;
rewrite "^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$2&isolang;=$1$4" last;
rewrite "^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$
/category.php?id_category=$2&isolang;=$1" last;
rewrite ^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$2$4 last;
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$1$3 last;
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1
last;
rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1
last;
rewrite ^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3
last;
rewrite ^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$
/manufacturer.php?id_manufacturer=$1$3 last;
rewrite "^/lang-([a-z]{2})/(.*)$ /$2?isolang=$1" last;
[/code]
[code]
# cat /usr/local/etc/nginx/php.conf
location ~ \.php$ {
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 SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
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;
# PHP only, required if PHP was built with
--enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
[/code]
thank you for any advice.
norman
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,170721,174129#msg-174129
More information about the nginx
mailing list