How to install Laravel 5 on Ubuntu/Nginx server

Posted May 27, 2015 18.3k views
NginxUbuntuPHP Frameworks


I have been trying to get Laravel 5 installed in my Ubuntu/Nginx server but not luck. I followed this tutorial but I keep getting the following error “502 Bad Gateway nginx/1.4.6 (Ubuntu)”.

Any idea what could be happening here? Have any one see this error after following this tutorial tutorial?

Is there any other tutorial that I could follow to install Laravel 5?


  • Seams that something is wrong with the php-fpm service.

    Check your nginx and php-fpm logs.

    tail -f /var/log/nginx/* /var/log/php*

    This article should help you more.

  • Thank you for your reply.

    Here is what I get when I run sudo tail -f /var/log/php*

    [27-May-2015 07:38:19] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

    And here is what I get when I runsudo tail -f /var/log/nginx/*
    tail: cannot open ‘/var/log/nginx/*’ for reading: No such file or director

    This is what I see when I open sudo vi /var/log/nginx/

  • Check if php5fpm process exist :

    sudo ps aux | grep php5

    Would it possible to paste your nginx config here. you can replace domain and sensitive info first

  • This is what I got when I typed sudo ps aux | grep php5

    root      11842  0.0  1.4  79088  7524 ?        Ss   May27   0:04 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
    username  13085  0.0  0.1  11740   932 pts/0    S+   07:27   0:00 grep --color=auto php5

    I hope non of this info compromises my server.


  • Any suggestion? I don’t want to give up that easy.

  • Show 2 more comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Problem solved, added user www-data; to file sudo vi /etc/nginx/nginx.conf and it did the trick.