there’s web page which uses zend framework. the web actually uses rewrites. I googled for solutions how to setup zend framework win nginx.. and they said it’s not necessary to convert those default rewrite .htaccess to nginx one..
anyway here’s .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteRule ^robots\.txt$ robots.txt
here’s nginx configuration of web page:
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/vhosts/domain.lt/httpdocs;
index index.php;
# Make site accessible from http://localhost/
server_name domain.lt;
server_name www.domain.lt;
location / {
if (-f $request_filename) {
root /var/www/vhosts/domain.lt/httpdocs;
}
}
location ~* ^/(favicon.ico|robots.txt)$ {
access_log off;
log_not_found off;
}
error_page 404 = /index.php;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/www;
#}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /var/www/vhosts/domain.lt/httpdocs/index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location ~* \.(css|js|jpeg|jpg|gif|png|ico|xml)$ {
access_log off;
expires 30d;
}
}
and finally error itself:
2013/02/03 01:52:13 [error] 12293#0: *29 open() "/var/www/vhosts/domain.lt/httpdocs/daiktai/kategorija/slaugos-ir-higienos-priemones/page/147" failed (2: No such file or directory), client: 66.249.75.237, server: domain.lt, request: "GET /daiktai/kategorija/slaugos-ir-higienos-priemones/page/147 HTTP/1.1", host: "www.domain.lt"
as you can see nginx considers every rewrite as a file entry, which of course – doesn’t exists. How can I fix this problem? web page actually works great without rewrites.
My question would be: how to remove these errors from error.log and do I need to convert that htaccess file to nginx rewrites? if so can you please convert it? I tried some online converters – RewriteCond and RewriteRule completely ignored.
found solution:
this whole part is wrong
I just added this to
serverand this to
location ~ \.php$