drew.d.lenhart

programming, software, technology, anything on my mind...

Installing Apache Web Server - Ubuntu 14.04

2014/08/05

So you have a version of Ubuntu running on an unused computer somewhere. Why not turn it into a fully functional web server! Why pay to host your site somewhere? YOU can be the Server Administrator! Brush up on your Linux skills, because we are going to install Apache Webserver.

* * * * *

Install Apache:

At the command line, type:

sudo apt-get update sudo apt-get install apache2 *Press "Y" to confirm installation.

Now lets see if it works! Open up a browser and type: http://localhost , or http://192.168.1.x. You should get a page that looks like this:

itworks

Some things to keep in mind:

  1. Apache stores your web files in the /var/www directory.
  2. Apache is defaulted to port 80, if for some reason your ISP blocks this port I recommend changing to port 8080. To do this you need to open the ports.conf file located in /etc/apache2/ directory.

To edit this file I would use:

sudo nano /etc/apache2/ports.conf

While in the file look for "Listen 80" simply change this to "Listen 8080". Lastly find "VirtualHost *:80" and change the 80 to 8080.

Now this is an important step. You need to restart Apache after you save the changes.

sudo /etc/init.d/apache2 restart

Now that the port has changed, open a browser and type: http://localhost:8080.

* * * * *

Now set up FTP to upload files.

Install FTP:

sudo apt-get install vsftpd

Edit vsftp.conf file:

sudo nano /etc/vsftpd.conf

Change the following:

>anonymous_enable=YES to NO Uncomment local_enable=YES add to the bottom of the file force_dot_files=YES.

To exit nano, press ctrl+x, Y to save, press enter when it displays the file name. Restart ftp:

sudo service vsftpd restart

Log into FTP using the servers IP address with a FTP program such as FileZilla. Logging into the FTP site will go to the user folder on the system. Create a shortcut in the user folder to direct to /var/www:

sudo ln -s /var/www ~/www

Take ownership of the webroot:

sudo chown -R (username) /var/www

Good luck and thanks for reading!

--Drew Lenhart