I try to convert apache rewrite rules for CMS phpwcms (www.phpwcms.de), but with the online converter tools and some adjustments recommended at the nginx wiki I still struggle with that.
That's my configuration
**Server**
Debian Whezzy
nginx v 1.6.2
php5-fpm 5.5.20-1~dotdeb.1 (fpm-fcgi)
**Rewrite Rule Apache**
RewriteEngine on
RewriteBase /
RewriteRule ^ (track|include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)($|/) - [L]
RewriteRule ^ index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ ([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.html$ /index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
RewriteRule ^ (.+)\.html$ /index.php?$1&%{QUERY_STRING}
Rewrite should do for example this:
http://hometest.home.local/home_de.html -> http://hometest.home.local/index.php?home_de
CMS without rewrite works fine.
Tests with the converted rewrite rules where not working and more confused then rewriting with the try_files option.
So I switched to test with try_files. Examples for wordpress or drupal where not working too.
Now I'm at this stage. I believe the main problem is the "QUERY_STRING", but I have no idea how that get rendered.
**Nginx Site Config /etc/nginx/sites-available/default :**
listen 80 default_server;
server_name hometest.home.local;
root /data/www/vhosts/default/public_html;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
rewrite_log on;
access_log /data/www/vhosts/default/logs/access.log;
error_log /data/www/vhosts/default/logs/error.log debug;
}
That's what the logfile shows.
**Nginx Error Log:**
[debug] 6102#0: *1 http run request: "/index.php?"
[debug] 6102#0: *1 http upstream check client, write event:1, "/index.php"
[debug] 6102#0: *1 http upstream recv(): -1 (11: Resource temporarily unavailable)
...
[error] 6102#0: *1 FastCGI sent in stderr: "PHP message: PHP Notice: Use of undefined constant Y - assumed 'Y' in /data/www/vhosts/default/public_html/include/inc_front/front.func.inc.php(2287) : eval()'d code on line 1
** front.func.inc.php(2287)**
function include_int_phpcode($string) {
// return the PHP code
$s = html_despecialchars($string[1]);
$s = str_replace('<br>', "\n", $s);
$s = str_replace('<br />', "\n", $s);
ob_start();
eval($s.";");
return ob_get_clean();
}
I hope someone can help me with this. The phpcwms forum couldn't give me an answer so fare.
Thank you
Daniel