Setting up an Apache2 web server has probably been one of the hardest things I’ve ever done, hands down. This post is mainly to serve to document and remind future me what I learned setting up Apache2 on my LUbuntu machine.
For starters, I found Ubuntu’s community page for setting up Apache quite helpful: https://help.ubuntu.com/community/ApacheMySQLPHP
(Notes about basic Apache usage):
default dir: /var/www/ sudo /etc/init.d/apache2 start #start apache sudo /etc/init.d/apache2 stop #stop apache sudo /etc/init.d/apache2 restart #restart apache cp default (sitename) sudo nano (sitename) sudo a2dissite default && sudo a2ensite (sitename) enables/disables symlinked filein ./sites-enabled sudo /etc/init.d apache2 reload
Then I had a problem adding a folder to /var/www. I didn’t remember to edit as super user (thank you StackOverflow):
sudo su sudo mkdir mysite (etc)
I found the following helpful just to see setup explained 2 different ways:
- Video: Creating virtual hosts on LAMP server (includes local host config so multiple site names get routed through port 80)
- Hosting Multiple Sites with Apache
Finally, with a little bit of tweaking to my router, I could finally access a static web page from other computers on my home network. Victory!