Welcome! Log In Create A New Profile

Advanced

Re: rewrite help needed.

Ian Hobson
August 26, 2009 09:35AM
Igor Sysoev wrote:
> On Wed, Aug 26, 2009 at 01:57:15PM +0100, Ian Hobson wrote:
>
>
>> 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.
>>
>
> location /blog/ {
> try_files $uri $uri/ /index.php;
> }
>
> location ~ \.php$ {
> include /etc/nginx/fastcgi_params;
> fastcgi_pass 127.0.0.1:9000;
> }
>
>
Thanks Igor for your super fast response.

I should have mentioned that I'm on ubuntu and therefore nginx 0.5.33
! No try-files.

So I must either compile nginx on (unfamilar) ubuntu, or work round the
missing try-files.

Regards

Ian
Subject Author Posted

rewrite help needed.

Ian Hobson August 26, 2009 08:57AM

Re: rewrite help needed.

Igor Sysoev August 26, 2009 09:10AM

Re: rewrite help needed.

Ian Hobson August 26, 2009 09:35AM

Re: rewrite help needed.

Igor Sysoev August 26, 2009 09:44AM

Re: rewrite help needed.

Maxim Dounin August 26, 2009 01:57PM

Re: rewrite help needed.

Nuno Magalhães August 26, 2009 09:55AM

Re: rewrite help needed.

Ian Hobson August 26, 2009 10:39AM

Re: rewrite help needed.

Jeff Waugh August 26, 2009 10:18AM

Re: rewrite help needed.

Ian Hobson August 26, 2009 11:44AM

Re: rewrite help needed.

Jeff Waugh August 26, 2009 12:59PM

Re: rewrite help needed.

Ian Hobson August 26, 2009 05:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready