Recently I’ve found a new PHP framework, the Laravel ( I bought a book about it (, that by the way it’s excellent, and went to study to use Laravel on a new project.

As always, my first challenge is doing a functional configuration on NGINX, to make Laravel running straight, and as CakePHP and WordPress, it comes with .htaccess ready for Apache. The book shows a configuration to a project that is based on the root of a webserver, but I put all my projects on subfolders on the VM that I use to develop, so it’s not the same thing as the book shows.

Laravel has a public folder as the project root, and the url pattern is like this: To work with pretty urls, my NGINX configuration is as follows:

Hope this helps other people. And also, I’m using Laravel 4.

7 thoughts on “NGINX Rewrite for Laravel

    1. Hello!

      Have you checked if you are running php-fpm through socket, and not through TCP/IP?
      This configuration I’ve posted uses php-fpm through socket: “fastcgi_pass unix:/var/run/php5-fpm.sock;”.

      If you’re trying to use socket, and php-fpm is running over TCP, it will give forbidden if I’m not mistaken…

  1. Cara estou com o problema sério pra usar url amigável no wordpress + phpFPM trabalho com VestaCP e ao re-importar meus backups optei por não instalar o servidor Apache.

    Poderia me ajudar nesta questão? como faço pra que o wordpress funcione com url amigável usando Nginx+PHPFPM?

    Fico no Aguardo


    1. Olá! Desculpe a demora para responder…
      seu comentário tinha caído em SPAM.

      Você poderia me enviar suas configurações?
      contato [at]

      Assim que eu receber, eu avalio e te ajudo…

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.