I was having a little trouble getting Laravel installed on a newly installed Ubuntu 14.04 LTS server. I’ve decided to document the whole process in hopes that I’ll use the documentation to good use once again sometime in the future. Who knows, someone will benefit from reading this. I’m not the only one that will be doing a Laravel installation on Ubuntu.
If you need to install Ubuntu from scratch, I recommend that use install LAMP and SSH because you’ll need those services to support Laravel. PHP, MySQL, Apache and SSH would be installed for you right out of the gate. In addition, I recommend that you install PHPMyAdmin for database administration.
In Ubuntu, the default document root is /var/www/. Before starting, let’s make sure we got the correct permissions for Apache, and for the user (you). This is to prevent so you don’t run into issues with write permissions on the document root.
Permissions for /var/www/
# Set group to www-datasudochgrp www-data /var/www
# Make it writable for the groupsudochmod775/var/www
# Set GID to www-data for all sub-folderssudochmod g+s /var/www
# Add your username to www-data groupsudo usermod -a-G www-data username
# Finally change ownership to usernamesudochown username /var/www/# Your account shouldn't have any more permission issues
Let’s get the prerequisites taken care of before installing Laravel
sudoapt-get install php5-curl
sudoapt-get install php5-mcrypt
# Create a symbolic linksudoln-s/etc/php5/mods-available/mcrypt.ini /etc/php5/conf.d/mcrypt.ini
# Enable extensionsudo php5enmod mcrypt
# Restart Apachesudo service apache2 reload
# Copy default Apache confsudo/etc/apache2/sites-available/000-default /etc/apache2/sites-available/laravel.conf
# Edit laravel.conf and change DocumentRoot to /var/www/laravel/publicsudonano/etc/apache2/sites-available/laravel.conf
# Edit laravel.conf add the following and save.
Options Indexes FollowSymLinks MultiViews
Allow Override All
allow from all
</Directory># Reload Apachesudo service apache2 reload
# Disable default Apache confsudo a2dissite 000-default.conf
# Enable laravel.confsudo a2ensite laravel.conf
# Reload Apachesudo service apache reload
Install Via the Laravel Installer
I found the Laravel installer to be the easiest way to install Laravel. Easier than Composer and Git.
Move it to /usr/local/bin
sudomv laravel /usr/local/bin/laravel
Make it executable
sudochmod +x /usr/local/bin/laravel
# projects is the destination foldercd/var/www/
laravel new projects
The cool thing about this example is, I didn’t need to change permissions to “app/storage” since the user has the correct permissions to /var/www. Access Laravel from the IP address of your Ubuntu Server. The IP address of your Ubuntu server should be set to static. The network config file is located in /etc/networking/interfaces.
Simple Invoices is a free, open source, web based invoicing system that you can install on your server, desktop, or at a service provider. I installed Simple Invoices on a webhost company I rather not mention. The application was working fine, until they tweak their PHP settings several months back. As a result, the PDF export in Simple Invoices no longer worked. I was bummed. So, I was forced to run Simple Invoices from my home server, which was fun, but the issue was, I can’t access it outside of the house.
So, I decided to install Simple Invoices on my new account at Linode. Now, the funny thing was, the application won’t even come up. Not even a login page. So, I searched online for a possible solution to my dilemma. Some suggested to increase the php memory settings to 128M, but that didn’t work out for me. At one time, I thought I had a missing pdo_mysql module, but that wasn’t the case. Then, I stumbled into something that led me to the ultimate discovery.
Simple Invoices has this configuration file called config.ini located inside the config folder. One thing this application doesn’t like are extra characters inside the config file. I happen to like funky passwords with interesting characters like +-)!@#. My MySQL password happens to have a close parenthesis in it. Essentially, this extra character caused the entire application to not start. So, I change my password, and sure enough, the application worked.
So, if you ever get a 500 internal server error with the Simple Invoices application, make sure you don’t have any of those extra characters inside your config.ini file. I wasted two hours trying to fix this issue, only to be surprised by such an idiotic requirement. That means I can’t use difficult passwords for this application. I think this is either a design issue or a funny requirement of the Zend Framework, which by the way, Simple Invoices is written on. It was somewhat funny, but I wasn’t amused.
I was wondering about the best way to implement and give permissions to webroot, also known as the root directory of your web server. I’m familiar with Ubuntu’s structure, so I’ll use Ubuntu’s default webroot directory, which is /var/www.
Based on numerous documents and discussions I’ve read online, the proper way to give permissions to webroot is to (1 ) add a user to the www-data group, (2) change webroot’s ownership to www-data, (3) give all members of www-data group read and right access.
ulysses = user
webroot = /var/www
www-data = user and group for Apache
Are you looking for ways to increase the speed of your website? Apache has a new module called mod_spdy which is a new networking protocol spawned by Google. Howtoforge has the install tutorial. It requires that you have access to your own web server, like a VPS or a home server.
SPDY (pronounced “SPeeDY”) is a new networking protocol whose goal is to speed up the web. It is Google’s alternative to the HTTP protocol and a candidate for HTTP/2.0. SPDY augments HTTP with several speed-related features such as stream multiplexing and header compression.
To use SPDY, you need a web server and a browser (like Google Chrome and upcoming versions of Firefox) that both support SPDY. mod_spdy is an open-source Apache module that adds support for the SPDY protocol to the Apache HTTPD server. This tutorial explains how to use mod_spdy with Apache2 on Ubuntu 12.04.
The mount command in Linux is used to attach a file system to a certain device. One of the least used features within mount is called bind. With bind, you can mount a certain directory to another directory within the file system. The result is, the files are accessible from both directories. This feature is particularly helpful when sharing files. I use it to map the home directory of a FTP user to the home directory of the web server. In this particular example, I’m using a FTP user called ‘ftpuser’ and mapping the drive to ‘/var/www,’ which is Apache’s home directory.
Mount Bind Command
Make It Permanent
To make this mount permanent, you need to add it to /etc/fstab.
I recently installed Ubuntu and the Apache web server on another desktop computer. If you like to know how to install Apache, please read my previous post about installing LAMP. In this instance, installing Ubuntu and Apache was a success. There is one minor issue however. Every time I restart the Apache web server, I would get this annoying message: “Could not reliably determine the server’s fully qualified domain name.” The error is more of a warning. It does not really affect the way Apache display web pages. It’s more of annoyance more than anything.
So, how do you get rid of this minor Apache error?
First things first, one of the things I would like to do when I install a new instance of Ubuntu is to assign the desktop’s hostname to “localhost.” In this case, I don’t have to worry about the hostname resolving to itself, since localhost is already bound to 127.0.0.1. You can change your hostname to localhost by typing this command on the Terminal:
You don’t have to do this if you prefer another hostname.
Now, to fixing the minor nuisance.
Edit the Apache config: /etc/apache2/apache2.conf.
You will need to edit the Apache configuration and add your hostname as ServerName. You can edit the file via the Terminal and using either vi or Gedit. I prefer to work vi for minor changes. Gedit is probably easier for most.
sudo gedit /etc/apache2/apache2.conf
If you haven’t done anything previously to the Apache configuration, it will probably be an empty file. In my case, it was. Just add the following:
If you are going to use a different hostname, you will need to add the fully qualified domain name or FQDN in this format.
After saving your changes, you will need to restart Apache to see if that minor annoyance is gone.
There is no such thing as a perfect server, but this particular one is as close as you can get to being perfect. This tutorial will walk you through how to install the Ubuntu 10.04 LTS Server with all the services available typically that you get from ISPs and hosters.
It contains the installation of Apache web server (SSL-capable), Postfix mail server with SMTP-AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL server, Courier POP3/IMAP, Quota, Firewall, etc. It also installs the free web hosting control panel called ISPConfig2. Here’s the link to the tutorial.
You’ve installed CodeIgniter and you’ve written a couple of applications. Now, you want to run two of your applications under one install of CodeIgniter. The following article discusses how to run several applications within a single install of CodeIgniter. The approach is accomplished using Apache’s Virtual Host.
Install Apache Virtual Host
1. To add a virtual host, edit /etc/apache2/sites-available/default. We will use “vhostname” as the virtual hostname in this example. Edit the default file and add the following: