rewrite help needed.
Ian Hobson
ian at ianhobson.co.uk
Wed Aug 26 16:57:15 MSD 2009
Hi All
I am trying to set up a wordpress site using nginx, and I am running
into trouble. Started with the page at
http://robertbasic.com/blog/wordpress-as-cms-tutorial/ but things are
not working. I think that my translation
oh an .htaccess file is wrong.
This is the Apache .htaccess file I wish to replace..
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
This is the file in sites-available. / gives an empty reply, /blog gives
a 404, and index.php?p=1 gives a url of
http://www.domain.com/blog/http:/www.domain.com/blog/hello-world/ and
the page contains "No input file specified".
# Statements for domain.com
server {
listen 80;
#
server_name domain.com www.domain.com ;
root /var/www/domain.com/htdocs;
access_log /var/www/domain.com/access.log combined;
index index.php index.html index.htm;
#
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
# serve static files
if (-f $request_filename) {
# expires 30d;
break;
}
# send all non-existing file or directory requests to index.php
if (!-e $request_filename) {
rewrite ^/blog/(.+)$ index.php?q=$1 last;
}
# password protect /usage
location ^~ /usage/ {
auth_basic "Please login";
auth_basic_user_file /var/www/domain.com/passwords;
}
# all .php requests to fastcgi using uri.
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
I suspect that the solution is really simple, but I can't see it.
Help much appreciated.
Ian
More information about the nginx
mailing list