Notes on Installing a Web Server (to Lubuntu)


Getting the web server itself installed is actually pretty easy.

Use "tasksel"

"Tasksel" is a Task Selector, or a Meta-Program installer — it bunches related programs together as a single task and installs them. But first, you (might have to) install tasksel itself. Oddly, it's not in the easy-to-use Lubuntu Software Center, probably because people think this is a big complicated thing. So we will have to install it from the command line. Open a terminal. In Lubuntu this can be done by clicking on the "start" menu -> System Tools -> LXTerminal

Type the following command:

sudo apt-get install tasksel

Quick review of what the above means.
sudo - super user do (perform command as root/administrator)
apt-get - this is a program for installing and removing other programs
install - (duh)
tasksel - the name of the program we want.

Once installed, run it.

sudo tasksel

(again, tasksel does big fundamental changes, so we need sudo)

Finally, arrow down to LAMP server and select it. (For these types of menus, you sometimes also have to "tab" from the menu to the "enter" or "confirm" button. Run it.

Congrats, you now have a web server. You can open a browser and visit "localhost" or "127.0.0.1" to confirm.

Now — what's a bit annoying is that your html directory isn't at "home" — it's in /var/www. Let's change that. (I copied the rest of this from a stack overflow question, but it works: )

Let's say your username is "biff" and you'd like to put your html files in the folder /home/biff/html— do the following

In my Ubuntu 14.04 LTS, the document root was set to /var/www/html. It was configured in the following file:

/etc/apache2/sites-available/000-default.conf

So just do a

sudo nano /etc/apache2/sites-available/000-default.conf

and change the following line to what you want:

DocumentRoot /var/www/html
(to)
DocumentRoot /home/biff/html


Also do a

sudo nano /etc/apache2/apache2.conf

and find this

<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

to

<Directory /home/biff/new/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

and save it.

After you saved your changes, just restart the apache2 webserver and you'll be done :)

sudo service apache2 restart

If you prefer a graphical text editor, you can just replace the sudo nano by a gksu gedit.