Tutorial

How to Install Laravel with an Nginx Web Server on Ubuntu 14.04

How to Install Laravel with an Nginx Web Server on Ubuntu 14.04
Not using Ubuntu 14.04?Choose a different version or distribution.
Ubuntu 14.04

Introduction

Laravel is a modern, open source PHP framework for web developers. It aims to provide an easy, elegant way for developers to get a fully functional web application running quickly.

In this guide, we will discuss how to install Laravel on Ubuntu 14.04. We will be using Nginx as our web server and will be working with the most recent version of Laravel at the time of this writing, version 4.2.

Install the Backend Components

The first thing that we need to do to get started with Laravel is install the stack that will support it. We can do this through Ubuntu’s default repositories.

First, we need to update our local package index to make sure we have a fresh list of the available packages. Then we can install the necessary components:

sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-mcrypt git

This will install Nginx as our web server along with the PHP tools needed to actually run the Laravel code. We also install git because the composer tool, the dependency manager for PHP that we will use to install Laravel, will use it to pull down packages.

Modify the PHP Configuration

Now that we have our components installed, we can start to configure them. We will start with PHP, which is fairly straight forward.

The first thing that we need to do is open the main PHP configuration file for the PHP-fpm processor that Nginx uses. Open this with sudo privileges in your text editor:

sudo nano /etc/php5/fpm/php.ini

We only need to modify one value in this file. Search for the cgi.fix_pathinfo parameter. This will be commented out and set to “1”. We need to uncomment this and set it to “0”:

cgi.fix_pathinfo=0

This tells PHP not to try to execute a similar named script if the requested file name cannot be found. This is very important because allowing this type of behavior could allow an attacker to craft a specially designed request to try to trick PHP into executing code that it should not.

When you are finished, save and close the file.

The last piece of PHP administration that we need to do is explicitly enable the MCrypt extension, which Laravel depends on. We can do this by using the php5enmod command, which lets us easily enable optional modules:

sudo php5enmod mcrypt

Now, we can restart the php5-fpm service in order to implement the changes that we’ve made:

sudo service php5-fpm restart

Our PHP is now completely configured and we can move on.

Configure Nginx and the Web Root

The next item that we should address is the web server. This will actually involve two distinct steps.

The first step is configuring the document root and directory structure that we will use to hold the Laravel files. We are going to place our files in a directory called /var/www/laravel.

At this time, only the top-level of this path (/var) is created. We can create the entire path in one step by passing the -p flag to our mkdir command. This instructs the utility to create any necessary parent path elements needed to construct a given path:

sudo mkdir -p /var/www/laravel

Now that we have a location set aside for the Laravel components, we can move on to editing the Nginx server blocks.

Open the default server block configuration file with sudo privileges:

sudo nano /etc/nginx/sites-available/default

Upon installation, this file will have quite a few explanatory comments, but the basic structure will look like this:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri $uri/ =404;
        }
}

This provides a good basis for the changes that we will be making.

The first thing we need to change is the location of the document root. Laravel will be installed in the /var/www/laravel directory that we created.

However, the base files that are used to drive the app are kept in a subdirectory within this called public. This is where we will set our document root. In addition, we will tell Nginx to serve any index.php files before looking for their HTML counterparts when requesting a directory location:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name localhost;

    location / {
            try_files $uri $uri/ =404;
    }
}

Next, we should set the server_name directive to reference the actual domain name of our server. If you do not have a domain name, feel free to use your server’s IP address.

We also need to modify the way that Nginx will handle requests. This is done through the try_files directive. We want it to try to serve the request as a file first. If it cannot find a file of the correct name, it should attempt to serve the default index file for a directory that matches the request. Failing this, it should pass the request to the index.php file as a query parameter.

The changes described above can be implemented like this:

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/laravel/public;
        index index.php index.html index.htm;

        server_name server_domain_or_IP;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
}

Finally, we need to create a block that handles the actual execution of any PHP files. This will apply to any files that end in .php. It will try the file itself and then try to pass it as a parameter to the index.php file.

We will set the fastcgi_* directives so that the path of requests are correctly split for execution, and make sure that Nginx uses the socket that php5-fpm is using for communication and that the index.php file is used as the index for these operations.

We will then set the SCRIPT_FILENAME parameter so that PHP can locate the requested files correctly. When we are finished, the completed file should look like this:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name server_domain_or_IP;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save and close the file when you are finished.

Because we modified the default server block file, which is already enabled, we simply need to restart Nginx for our configuration changes to be picked up:

sudo service nginx restart

Create Swap File (Optional)

Before we go about installing Composer and Laravel, it might be a good idea to enable some swap on your server so that the build completes correctly. This is generally only necessary if you are operating on a server without much memory (like a 512mb Droplet).

Swap space will allow the operating system to temporarily move data from memory onto the disk when the amount of information in memory exceeds the physical memory space available. This will prevent your applications or system from crashing with an out of memory (OOM) exception when doing memory intensive tasks.

We can very easily set up some swap space to let our operating system shuffle some of this to the disk when necessary. As mentioned above, this is probably only necessary if you have less than 1GB of ram available.

First, we can create an empty 1GB file by typing:

sudo fallocate -l 1G /swapfile

We can format it as swap space by typing:

sudo mkswap /swapfile

Finally, we can enable this space so that the kernel begins to use it by typing:

sudo swapon /swapfile

The system will only use this space until the next reboot, but the only time that the server is likely to exceed its available memory is during the build processes, so this shouldn’t be a problem.

Install Composer and Laravel

Now, we are finally ready to install Composer and Laravel. We will set up Composer first. We will then use this tool to handle the Laravel installation.

Move to a directory where you have write access (like your home directory) and then download and run the installer script from the Composer project:

cd ~
curl -sS https://getcomposer.org/installer | php

This will create a file called composer.phar in your home directory. This is a PHP archive, and it can be run from the command line.

We want to install it in a globally accessible location though. Also, we want to change the name to composer (without the file extension). We can do this in one step by typing:

sudo mv composer.phar /usr/local/bin/composer

Now that you have Composer installed, we can use it to install Laravel.

Remember, we want to install Laravel into the /var/www/laravel directory. To install the latest version of Laravel, you can type:

sudo composer create-project laravel/laravel /var/www/laravel

At the time of this writing, the latest version is 4.2. In the event that future changes to the project prevent this installation procedure from correctly completing, you can force the version we’re using in this guide by instead typing:

sudo composer create-project laravel/laravel /var/www/laravel 4.2

Now, the files are all installed within our /var/www/laravel directory, but they are entirely owned by our root account. The web user needs partial ownership and permissions in order to correctly serve the content.

We can give group ownership of our Laravel directory structure to the web group by typing:

sudo chown -R :www-data /var/www/laravel

Next, we can change the permissions of the /var/www/laravel/app/storage directory to allow the web group write permissions. This is necessary for the application to function correctly:

sudo chmod -R 775 /var/www/laravel/app/storage

You now have Laravel completely installed and ready to go. You can see the default landing page by visiting your server’s domain or IP address in your web browser:

http://server_domain_or_IP

Laravel default landing page

You now have everything you need to start building applications with the Laravel framework.

Conclusion

You should now have Laravel up and running on your server. Laravel is quite a flexible framework and it includes many tools that can help you build out an application in a structured way.

To learn how to use Laravel to build an application, check out the Laravel documentation.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Justin Ellingwood
Justin Ellingwood
See author profile
Category:
Tutorial

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
50 Comments
Leave a comment...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

hey, thanks for the tutorial. how do i install mysql + phpmyadmin. i want the url looks like this localhost/phpmyadmin. thanks

If you want to install phpmyadmin to your website ,easier way is 1)Install a clean LEMP stack 2)Install PHPmyadmin 3)Import your database 4)Follow this tutorial to install laravel 5)If you want to use phpmyadmin again you can restart server and and specify the line root /usr/share/nginx/html; in nginx server block or wherever you have installed phpmyadmin.

i followed those steps up to the point where i need to restart but it cant find apache, was there something to do inbetween those steps or a different option?

Justin Ellingwood
DigitalOcean Employee
DigitalOcean Employee badge
June 26, 2014

winanda.aji: Try taking a look at our phpMyAdmin tutorial for Ubuntu 14.04.

Let us know how it goes!

hey again, thanks for the response i’ve had no problem using apache, how do integrate laravel+nginx+mysql+phpmyadmin, i’ve managed to install nginx and laravel, using this tuts, but when i tried to access localhost, it returned the laravel main page, so, back to the question, how do i make integrate phpmyadmin so the url will look localhost/phpmyadmin or localhost/pma.

I must have done something wrong, I am still seeing the default apache2 ubuntu page when I enter the URL in the browser. Any common error newbies make while configuring /etc/nginx/sites-available/default ?

Thanks!

nevermind, the problem was fixed by rebooting the server, thanks, excellent tutorial!

Hi! Great tutorial, I will try this in a new droplet. I have a question: how good is nginx over apache??? Thanks!!!

Great tutorial. Like the guy above me said an article on apache vs nginx would be pretty cool!

This is great, thanks! I’ve followed this but can get artisan to work. When I try ‘php artisan list’ I get “Could not open input file: artisan”

What am I missing here?

@winanda.aji:

Laravel does not integrate with PHPMyAdmin - Both are applications, used for different purposes. Laravel is used to develop custom applications that serve a specific purpose, and PHPMyAdmin is a specific application, written in it’s own “framework”, to allow you to administrate a MySQL Server.

@justingoetz417:

http://gwan.com/benchmark http://www.rootusers.com/web-server-performance-benchmark/ http://nbonvin.wordpress.com/2011/03/14/apache-vs-nginx-vs-varnish-vs-gwan/

I did a presentation one time on setting up Varnish as a Front End Proxy with Cherokee as the web server and these were some of the benchmarks I found while researching it.

@jbarker:

Are you in the base_path()? Your working directory needs to be the root of the Laravel application. (eg, an ls will return stuff like “app”, “bootstrap”, “composer.json”, “vendor”, etc)

@alealvaro:

Nginx is about 2x as fast as Apache, but after ~600 users, Nginx’ performance starts to seriously suffer.

Apache is about 1/2x as fast as Nginx, but it seems to have no internal limit to how many concurrent connections it can handle.

This is probably why Apache is usually used as a backend server with Nginx running as an accelerator.

Sources: The links in my above comment.

Got it sorted…just needed to run ‘sudo composer update’ in the project folder, artisan now works

I am very new to ubuntu 14.04 and Laravel. I followed all the steps mentioned in blog but when I do http://ip_addr_ofmy_machine then instead of you have arrived page I get, Welcome to ngix! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx.

Is this right behaviour or am I missing something? Thanks

P.S. when I do sudo service nginx restart then I get

  • restarting ngix ngix [fail]

This comment has been deleted

    This comment has been deleted

      Pratikkaje I am getting the same error. Followed steps exactly and get the nginx page not the laravel page

      HELP!

      I was getting the same error, but I found that i inverted two letters on a line, and I kept reading it right in my mind.

      try running: sudo nginx -c /etc/nginx/nginx.conf -t

      allow you to read the log error if there is one.

      Seth

      Hi there everyone i’ve tried this tutorial and everything worked fine and i install laravel succesfully but when browse to my server trough my ip it gives me a 404.

      Can anyone please help me?

      My laravel is located in : /var/www/laravel/laravel

      and this is my nginx config file

      server {
              listen 80 default_server;
              listen [::]:80 default_server ipv6only=on;
      
              root /var/www/laravel/laravel;
              index index.php index.html index.htm;
      }
      
      location / {
      
                      try_files $uri $uri/ index.php?$query_string;
              }
      
      location ~ \.php$ {
                      try_files $uri /index.php =404;
                      fastcgi_split_path_info ^(.+\.php)(/.+)$;
                      fastcgi_pass unix:/var/run/php5-fpm.sock;
                      fastcgi_index index.php;
                      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                      include fastcgi_params;
      }
      
      

      can anyone please help me with this issue ? thanks in advance.

      Kamal Nasser
      DigitalOcean Employee
      DigitalOcean Employee badge
      October 10, 2014

      Your config file should look like this:

      server {
              listen 80 default_server;
              listen [::]:80 default_server ipv6only=on;
      
              root /var/www/laravel/public;
              index index.php index.html index.htm;
      
              location / {
                      try_files $uri $uri/ index.php?$query_string;
              }
      
              location ~ \.php$ {
                      try_files $uri /index.php =404;
                      fastcgi_split_path_info ^(.+\.php)(/.+)$;
                      fastcgi_pass unix:/var/run/php5-fpm.sock;
                      fastcgi_index index.php;
                      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                      include fastcgi_params;
              }
      
      }
      

      Update it and restart nginx:

      sudo service nginx restart
      

      should add the server_name with http://ipaddress or remove the http//??

      Justin Ellingwood
      DigitalOcean Employee
      DigitalOcean Employee badge
      January 12, 2015

      @arduino731: For the server_name directive, you should not include the protocol, so it should just be server_name ip_address; if you are using an IP address.

      it works thanks this got me confused

      @kamaln7

      The problem occurs when i edit my config file and after that the nginx can’t restart. Thats a common problem i’ve heard.

      This comment has been deleted

        Hi! I have followed this tutorial on Debian 7 and it works! Thanks!

        This is good, but i use apache instead of nginx.

        Can you give me a tutorial about laravel and apache?

        Thanks.

        EDIT:

        After a close research on the internet, i found this tutorial and i finally managed to install laravel for my apache web server. A bonus point is that it has instructions for Twitter bootstrap as well. Very nice article.

        Thanks x 1000 :) That’s the best explanation I’ve seen. :)

        If you want to install phpmyadmin to your website ,easier way is 1)Install a clean LEMP stack 2)Install PHPmyadmin 3)Import your database 4)Follow this tutorial to install laravel 5)If you want to use phpmyadmin again you can restart server and and specify the line root /usr/share/nginx/html; in nginx server block or wherever you have installed phpmyadmin.

        How would a NGNIX configuration for TLS/SSL would look like? I’ve currently got the following adjustments:

            listen 443;
            ssl on;
            ssl_certificate /path/to/crt;
            ssl_certificate_key path/to/key;
        
            ssl_prefer_server_ciphers on;
            add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
        

        (For server ciphers and Strict-Transport-Security -> https://aralbalkan.com/scribbles/setting-up-ssl-with-nginx-using-a-namecheap-essentialssl-wildcard-certificate-on-digitalocean/ ) This works great for me, however I would like to redirect port 80 to 443 automatically and I think it is good to hide nginx / php version from the server information?

        Like Server: nginx/1.6.2 (curl -I mydomain.tld)

            HTTP/1.1 302 Found
            Server: nginx/1.6.2
            Content-Type: text/html; charset=UTF-8
            Connection: keep-alive
            X-Powered-By: PHP/5.6.3
            Cache-Control: no-cache
            Date: Sat, 29 Nov 2014 11:31:59 GM
            Location: '.. location..'
            (...)
        
        Justin Ellingwood
        DigitalOcean Employee
        DigitalOcean Employee badge
        December 2, 2014

        @wiesson: For your SSL question this might be helpful for a base guide.

        To redirect port 80 to port 443 automatically, you should implement an additional server block for port 80 and have that redirect to your SSL-protected server block, like this:

        server {
            listen 80;
            server_name example.com;
            return 301 https://example.com$request_uri;
        }
        
        server {
            listen 443 ssl;
            server_name example.com;
        
            . . .
        
        }
        

        For your Nginx version, you can turn that off by placing server_tokens off in your Nginx configuration in the http block. For the PHP version, you can either drop that header, or tell PHP not to expose it in the first place. The latter is probably the best approach. Set expose_php = Off in the /etc/php5/fpm/php.ini file.

        Perfect tutorial, thank you so much ! Worked from the first try :) (I battled for 2 weeks with bluehost then I decided to change to digital ocean to see the difference…)

        Thanks @Sethbass99 I was having the same issue, and checking in the log file, as you said, I saw I had missed a closing bracket ‘}’.

        Thank for the tutorial! But I’m still stuck with this message in FireFox when I enter http://192.168.178.25 : Error in exception handler. I’ve checked the installation twice, but all seems in order. Can anyone tell my how I can trace this problem ?

        thanks, pjotrb

        @pjotrb , you can see what’s the problem by going into app/config/app.php and turning 'debug' => false to 'debug' => true.

        I just solved my Error in exception handler – turns out i did

        sudo chmod -R 755 /var/www/laravel/app/storage
        

        instead of

        sudo chmod -R 775 /var/www/laravel/app/storage
        

        Pretty amateur mistake for me, but when you’re working at 2am in the night… :)

        I am keeping getting this restarting nginx nginx fail! what I am doing to check the config by sudo nginx -c /etc/nginx/nginx.conf -t it said

        nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successfull 
        
        
        
        server {
        	listen 80 default_server;
        	listen [::]:80 default_server ipv6only=on;
        
        	root /var/www/html/laravel/public;
        	index index.php index.html index.htm;
        
        	# Make site accessible from http://localhost/
        	server_name 223.222.3.222;
        
        	location / {
        		# First attempt to serve request as file, then
        		# as directory, then fall back to displaying a 404.
        		try_files $uri $uri/ index.php?$query_string;
        		# Uncomment to enable naxsi on this location
        		# include /etc/nginx/naxsi.rules
                	}
        
        	location ~ \.php$ {
        	try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
            	}
        }
        
        
        

        I do not see what wrong with it?

        Justin Ellingwood
        DigitalOcean Employee
        DigitalOcean Employee badge
        January 12, 2015

        @arduino731: For starters, your try_files directive in the location / {} block should have a leading slash (/) before the index.php?$query_string; portion of the line, like this:

        try_files $uri $uri/ /index.php?$query_string;
        

        That’s the only obvious thing that stands out to me. Does just running sudo nginx -t give the same successful result?

        Check the logs at /var/log/nginx/access.log and /var/log/nginx/error.log to see if there is any relevant information.

        @jellingwood your answered were correct by… For the server_name directive, you should not include the protocol, so it should just be server_name ip_address; if you are using an IP address.

        You need to restart after the last step, other wise the doc root is not getting updated.

        i follow all the step u have given… bt still index.php from public folder does not run why is it so?? plz rpy

        Justin Ellingwood
        DigitalOcean Employee
        DigitalOcean Employee badge
        February 17, 2015

        @diptipatil303: Sorry, it’s going to be difficult to troubleshoot with you if you don’t give us more information. What are you seeing instead of the output produced by processing the index.php file? What are the contents of your /var/log/nginx/access.log, /var/log/nginx/error.log, and your /var/log/php5-fpm.log files?

        Hi,

        When you download laravel through composer now you get the latest release which is laravel 5 and they have made some changes in the directory structure. When you change the permissions of the /var/www/laravel/app/storage directory it won’t work because it has moved, to /var/www/laravel/storage. So to correct line would be:

        sudo chmod -R 775 /var/www/laravel/storage
        

        According to documentation, Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run:

        sudo chmod -R 775 /var/www/laravel/storage
        sudo chmod -R 775 /var/www/laravel/bootstrap/cache
        

        This is good, but i use apache instead of nginx.

        Can you give me a tutorial about laravel and apache?

        Thanks.

        EDIT:

        After a close research on the internet, i found this tutorial and i finally managed to install laravel for my apache web server. A bonus point is that it has instructions for Twitter bootstrap as well. Very nice article.

        Thanks x 1000 :) That’s the best explanation I’ve seen. :)

        If you want to install phpmyadmin to your website ,easier way is 1)Install a clean LEMP stack 2)Install PHPmyadmin 3)Import your database 4)Follow this tutorial to install laravel 5)If you want to use phpmyadmin again you can restart server and and specify the line root /usr/share/nginx/html; in nginx server block or wherever you have installed phpmyadmin.

        How would a NGNIX configuration for TLS/SSL would look like? I’ve currently got the following adjustments:

            listen 443;
            ssl on;
            ssl_certificate /path/to/crt;
            ssl_certificate_key path/to/key;
        
            ssl_prefer_server_ciphers on;
            add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
        

        (For server ciphers and Strict-Transport-Security -> https://aralbalkan.com/scribbles/setting-up-ssl-with-nginx-using-a-namecheap-essentialssl-wildcard-certificate-on-digitalocean/ ) This works great for me, however I would like to redirect port 80 to 443 automatically and I think it is good to hide nginx / php version from the server information?

        Like Server: nginx/1.6.2 (curl -I mydomain.tld)

            HTTP/1.1 302 Found
            Server: nginx/1.6.2
            Content-Type: text/html; charset=UTF-8
            Connection: keep-alive
            X-Powered-By: PHP/5.6.3
            Cache-Control: no-cache
            Date: Sat, 29 Nov 2014 11:31:59 GM
            Location: '.. location..'
            (...)
        

        Perfect tutorial, thank you so much ! Worked from the first try :) (I battled for 2 weeks with bluehost then I decided to change to digital ocean to see the difference…)

        Thanks @Sethbass99 I was having the same issue, and checking in the log file, as you said, I saw I had missed a closing bracket ‘}’.

        Thank for the tutorial! But I’m still stuck with this message in FireFox when I enter http://192.168.178.25 : Error in exception handler. I’ve checked the installation twice, but all seems in order. Can anyone tell my how I can trace this problem ?

        thanks, pjotrb

        You need to restart after the last step, other wise the doc root is not getting updated.

        i follow all the step u have given… bt still index.php from public folder does not run why is it so?? plz rpy

        Hi,

        When you download laravel through composer now you get the latest release which is laravel 5 and they have made some changes in the directory structure. When you change the permissions of the /var/www/laravel/app/storage directory it won’t work because it has moved, to /var/www/laravel/storage. So to correct line would be:

        sudo chmod -R 775 /var/www/laravel/storage
        

        Hi, I am trying to setup existing application on VPS using your methods but no success :/

        Hello,

        There is an error in this HowTo. More precisely here :

        Next, we can change the permissions of the /var/www/laravel/app/storage directory to allow the web group write permissions. This is necessary for the application to function correctly:
        
        sudo chmod -R 775 /var/www/laravel/app/storage
        

        Indeed, I met an error when I want to modify chmod in the following directory :

        /var/www/laravel/app/storage
        

        This is the right path :

        /var/www/laravel/storage
        

        Thanks

        thank you very much.

        if you install Laravel 5, the storage folder is up one level so instead of :

        sudo chmod -R 775 /var/www/laravel/app/storage

        run

        sudo chmod -R 775 /var/www/laravel/storage

        If anyone is installing Laravel 5, the command sudo chmod -R 775 /var/www/laravel/app/storage should be sudo chmod -R 775 /var/www/laravel/storage. Other than that everything else has worked for me.

        Hi,

        Thanks for the tutorial. What configuration should I have if I want to access one Laravel project at mydomain.com/project1 and another one at mydomain.com/project2?

        Right now my config looks like the final one in the tutorial.

        Best regards, Carl

        This comment has been deleted

          Very nice tutorial Justin, thanks. :)

          I have a question tho…

          I would like to use laravel with HHVM and nginx instead of PHP and nginx.

          I followed this tutorial in an attempt to get laravel working with HHVM. I’ve used the default HHVM config file in nginx instead of the cgi php-fpm sock file in this tutorial. There are no errors when following the tutorial and I can run PHP code (phpinfo(); shows hiphop page). However, the laravel page is just empty, white. :(

          I checked the nginx logs and it tells me that the /app/storage folder does not have the right writing rights. I’ve chmodded everything but still the white page. I’m using the latest versions at this date, any idea how I can get laravel to work with HHVM instead of PHP?

          This is an excellent article, thank you!

          is this post valid for laravel 5 . Im interested deploying on digital ocean but before i need to know the experience you guys had and any issues encountered. Thanks in advance…

          Try DigitalOcean for free

          Click below to sign up and get $200 of credit to try our products over 60 days!

          Sign up

          Join the Tech Talk
          Success! Thank you! Please check your email for further details.

          Please complete your information!

          Become a contributor for community

          Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

          DigitalOcean Documentation

          Full documentation for every DigitalOcean product.

          Resources for startups and SMBs

          The Wave has everything you need to know about building a business, from raising funding to marketing your product.

          Get our newsletter

          Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

          New accounts only. By submitting your email you agree to our Privacy Policy

          The developer cloud

          Scale up as you grow — whether you're running one virtual machine or ten thousand.

          Get started for free

          Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

          *This promotional offer applies to new accounts only.