One of the best perks for a web developer switching to a Unix based operating system like mac/linux is the relative ease of setting up a environment for web development. Most web servers are linux/unix based and developing on a machine that better mimics a their environment is of great benefit.
Previously on Ubuntu, setting up a solid web server included grabbing multiple packages and a little bit of hand holding to get things right.
However, now that’s changed. Getting a functional web server on Ubuntu not only installed, but up and running now only takes 1 command.
Wait for it…..
Wait for it…..
sudo apt-get install lamp-server^
Yup that’s it.
Follow the prompts, particularly for mySQL and make sure you remember your user/pass (do yourself a favor and make it simple or you’ll regret it).
Once it is done with all the prompt just type:
sudo /etc/init.d/apache2 restart
Now, in your browser go to http://127.0.0.1 or localhost and you should see a page that says, “IT WORKS” which in short means, well… that your web server is functionining.
Now just navigate to your web server root directory using
cd /var/www/
to check out the contents.
BONUS.
Here are a few quick Apache commands for you to chew on:
To start Apache:
sudo /etc/init.d/apache2 start
To stop Apache:
sudo /etc/init.d/apache2 stop
and of course, to restart apache in one command:
sudo /etc/init.d/apache2 restart
Part 2 will cover a quick vhost setup that can simplify your webserver / working environment and drastically increase tidyness and productivity. That will be coming soon.