I have recently started using nginx with PHP-FPM to serve PHP files, and this is blazing fast. However, where there are rewritten URLs, Apache becomes a bottleneck. How can I have nginx do the rewriting?
Let's say that I'm trying the following kind of rewrite in Apache:
The equivalent code for nginx should be something like this:
But I'm not sure where I should insert this in the Plesk config.
Just to show what kind of performance difference we're talking about here, my benchmarking using ab shows that nginx with PHP-FPM can serve over 9000 reqs / sec. If it has to go through Apache's URL rewriting, that drops to 150 reqs / sec (!!)
Let's say that I'm trying the following kind of rewrite in Apache:
Code:
RewriteRule /cat/([0-9]*) /index.php?cat=$1 [NC]
The equivalent code for nginx should be something like this:
Code:
location ~ /cat/(.*) {
return 301 /index.php?cat=$1 last;
}
But I'm not sure where I should insert this in the Plesk config.
Just to show what kind of performance difference we're talking about here, my benchmarking using ab shows that nginx with PHP-FPM can serve over 9000 reqs / sec. If it has to go through Apache's URL rewriting, that drops to 150 reqs / sec (!!)