Welcome to Geeklog Monday, May 29 2017 @ 03:37 am EDT


Status: offline

joelbarrios

Forum User
Junior
Registered: 03/05/2004
Posts: 22
Location:Mexico
I'm migrating from Apache to Nginx. So far Geeklog works pretty good in my tests. I'm pleased to share with you the rewrite rules needed to make work the url rewrite of geeklog. Just put them inside location / { ... }.

CONFIG Formatted Code
rewrite ^/article.php/(.*)$ /article.php?story=$1 last;
rewrite ^/staticpages/index.php/(.*)$ /staticpages/index.php?page=$1 last;
rewrite ^/links/portal.php/link/(.*)$ /links/portal.php?what=link&item=$1 last;
rewrite "^/directory.php/all/(\d{1,})/(\d{1,})$" /directory.php?topic=all&year=$1&month=$2 last


If you run Geeklog as nonroot directory, such as location /geeklog { ... }, use these ones:

CONFIG Formatted Code
rewrite ^/geeklog/article.php/(.*)$ /geeklog/article.php?story=$1 last;
rewrite ^/geeklog/staticpages/index.php/(.*)$ /geeklog/staticpages/index.php?page=$1 last;
rewrite ^/geeklog/links/portal.php/link/(.*)$ /geeklog/links/portal.php?what=link&item=$1 last;
rewrite "^/geeklog/directory.php/all/(\d{1,})/(\d{1,})$" /geeklog/directory.php?topic=all&year=$1&month=$2 last;
 


Dirk, please it would be worderful if these get included in Geeklog documentation. Will spare lots of suffering to Nginx users.

Enjoy!
-- http://www.AlcanceLibre.org/ La libertad del conocimiento al alcance de quien la busca.

Status: offline

Dan Stoner

Forum User
Chatty
Registered: 28/01/2009
Posts: 43
Location:Gainesville, FL
THANK YOU for this.

I tried migrating from apache to nginx a while back and failed. These rules solve the issue I was having where the initial site would load ok but would get 404 for any article when I had search engine friendly urls enabled.

I now have geeklog running with nginx and php-fpm. Cool

Status: offline

ivy

Forum User
Full Member
Registered: 25/11/2004
Posts: 265
Location:Tokyo Japan
Hi,

Please see more hiroron's site about nginx.

Session error fix:
https://www.winkey.jp/article.php/20130507134319996

Activate Expires and Deflate
https://www.winkey.jp/article.php/20140522171355469


Geeklog Japan https://www.geeklog.jp

Status: offline

Dan Stoner

Forum User
Chatty
Registered: 28/01/2009
Posts: 43
Location:Gainesville, FL
One more bit I found on this topic.

I noticed lines such as this in my nginx error log:

PLAIN Formatted Code

2016/09/15 21:14:21 [error] 4431#0: *79935 open() "/var/www/path/to/site/blog/directory.php/running/2016/1" failed (20│··
: Not a directory), client: 128.227.144.179, server: thatlinuxbox.com, request: "GET /blog/directory.php/running/2016/1 HTTP/1.1│··
", host: "thatlinuxbox.com", referrer: "http://thatlinuxbox.com/blog/directory.php"
 


Browsing the site, from the Directory page, if one selects a topic other than "All" and then tries to view a particular month, the request will fail.

Changing the hard-coded "all" to instead capture the supplied topic name seems to work.

Change this line:

CONFIG Formatted Code

rewrite "^/directory.php/all/(\d{1,})/(\d{1,})$" /directory.php?topic=all&year=$1&month=$2 last;
 


to this:

CONFIG Formatted Code

rewrite "^/directory.php/(.*)/(\d{1,})/(\d{1,})$" /directory.php?topic=$1&year=$2&month=$3 last;
 


Thanks again joelbarrios for sharing your original set of rules.

All times are EDT. The time is now 03:37 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content