Getting OpenClassifieds to work with nginx

For sometime now I have been looking for an Open Source solution to create a classifieds site for sysarmy.

I stumbled upon Open Classifieds and seeing all the (really impressive !) features it has I decided to give it a shot inside my test VPS.

Open Classifieds is written in PHP and uses Kohana, a HMVC framework.

The installation process is pretty straight-forward. If you run Apache. The problem is that there isn’t (or at least I couldn’t find) comprehensive information about how to run it under nginx.

Kohana relies on mod_rewrite for doing magic with the URI’s, and the OC’s installation script creates a .htaccess file (that of course doesn’t work in nginx).

After digging in many places I came up with a fairly decent nginx config that allowed me to do the basic redirects. I’m posting it here since it took me a while to get it working:

#Minimum configuration
server {
  listen 80;
  root /usr/share/nginx/html/openclassifieds;
  index index.php;
  client_max_body_size 2M;</code>

  location / {
    try_files $uri $uri/ @kohana;

  location ~ /\. {
    deny all;

  location @kohana {
    rewrite ^/(.+)$ /index.php$request_uri last;

  location ~* \.php {
    fastcgi_pass unix:/var/run/php-fpm/www.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param KOHANA_ENV development;
    fastcgi_cache off;
    fastcgi_index index.php;

I have to say Open Classifieds seems like a solid product but the default theme is pretty lame (and the premium ones cost over u$s 100). I’ll give it a try for a few weeks before deciding if it’s a fit for what I’m looking for.

P.S.: The picture you saw at the top was from Igor Sysoev’s visit to Buenos Aires.


One thought on “Getting OpenClassifieds to work with nginx

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s