Projects: Setting Up a Local Server Environment

Alright, well this morning was off to a slow start. While the world anticipated Labor Day Weekend and getting the last modicum of work done, I read a chapter from a novel by Elizabeth Gilbert while drinking a hot cup of coffee and spent hours improving my chess notation. It was unproductive, alright.

After wrestling with the paralysis of being able to do anything and everything, I decided on a simple goal: make a WordPress site from scratch!

So far, I’ve only learned HTML, CSS and Javascript and stayed in the realm of the front-end and the comforts of the browser. I kept finding myself in situations and projects where I simply did not have any idea of what to do, where to start or what it entails. It was only evident that I develop a working knowledge of server environments and the back-end. Eventually, i’ll walk the walk and talk the talk as a web-developer.



How to get started: Set up local server environment on the computer

  1. Set up a local “LAMP Stack” style environment – http://localhost:8080
    • LAMP stands for Linux, Apache, MySQL, PHP(/Python/Perl). It’s an open source bundle of software applications that creates a dynamic web server environment. There is also MAMP and WAMP, for Mac and Windows, respectively.
    • Whether you have a PC or a Mac, just download MAMP and install it on your computer.
  2. I had a hiccup opening port 80 for Apache, administering as occupied, and found a simple solution on Stack Overflow:
    • Run MAMP
    • Click Preferences
    • On Preference window click Ports
    • While on Ports change Apache & Nginx Port to 8080.
      click ok
    • Start Servers.
  3. Along the way, I learned that Port 8080 is a place to host a secondary or alternate web server. It is commonly used for proxy and caching.
    • The computer has 65535 potential ports to use over the internet.
    • Your web browser works on port 80. Port 8080 is typically used for a personally hosted web server, when the ISP restricts this type of usage for non-commercial customers. If you were going to host your own website from your computer, you would prefer to be able to do so on port 80, since this would mean that anyone connecting to your computer wouldn’t have to add a port number to the end of the WWW address you paid for. They could just connect to it, or to your specific IP address, and they’d have the website visible in their browser, while being served from your desktop or laptop.
    • Some ISPs want to avoid people paying for a cheaper home connection, but using it for commercial webservice. So, they restrict access on port 80. To get around this, you can use whatever port you like. You could use port 12345 if you wanted to. Port 8080 is the just the default second choice for a webserver.
  4. Test PHP
    • I saved my html file to a php and opened it on the local server.
    • To test PHP, we can insert the pho tag anywhere into html. Anything that goes inside the opening tag of <?php and the closing tag of ?> work it’s magic on your server and return HTML.
      <p>Hello, world! The year is <?php echo date('Y'); ?>.</p>

      The code <?php echo date(‘Y’); ?> uses a date function to find the year. The HTML interpreted is just “2017”.

Yay, I  now have a local server and run all the PHP code I want!!!



Next Step: Setting Up Virtual Hosts

I’ve successfully added a virtual host from allowing virtual hosts on Apache, allowing SymLink Override and to adding a virtual host path. But I got absurdly stuck on removing the :8080 from the end of the URL.

The problem can be reframed from my inability to open up port :80 for Apache. Since I’m not focusing on working on multiple websites yet, which the Virtual Hosts allows me to do, I decided to move on and focusing on my local host. I was comforted by the fact that there was an absurd amount of people who were facing the same problem as I. Unfortunately, I didn’t find any solutions after disabling countless Services and Programs and playing with the configuration files. If you guys have any fail proof ideas on how to open up port 80 for Apache, let me know!

Now that I’ve set up the local server environment and I can pretend like I know that back-end like the back of my hand, it’s time to move on to the main event, WordPress. Stay tuned, self! Can’t wait to see what I come up with.


One thought on “Projects: Setting Up a Local Server Environment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s