Set up local apache server on MacOS Mojave
Wed 26 September, 2018
Host a website locally using the built-in server on your Mac
All Macs have a built-in Apache HTTP server which you can set up and utilise in a few minutes with zero experience.
You might use an Apache Server to create a website and host it locally on your Mac. This could be something like a custom homepage for your browser (which I use myself) or a playground to start learning website development.
1. Open “Terminal” Application, found in /Applications/Utilities and type the following command:
sudo apachectl start
and press Enter ↵
2. Go to your browser, type localhost in the address bar, and press Enter ↵.
When the localhost page is loaded you should see “It works!” in your browser.
How to Edit the Hosts File on Mac OS X
Create a new folder where you can store multiple sites hosted on your local server.
We will change the “DocumentRoot” setting in the file /etc/apache2/httpd.conf, and restart Apache.
1. To find the hosts file, open Finder and, in Finder’s menu bar, select Go > Go to Folder… In the box, type the following location and press Return.
(⇧⌘G) Go to Folder… shortcut
2. Enter the following and Go:
3. Double click and open the “httpd.conf“ file
DocumentRoot “/Library/WebServer/Documents" <Directory “/Library/WebServer/Documents">
5. Change it to
DocumentRoot “/Users/Lunar/Sites" <Directory “/Users/Lunar/Sites">
Where “Lunar” is your username.
6. Restart the Apache server in Terminal by running the following command:
sudo apachectl restart
7. Now you can access a site in the new “Sites” folder by adding the file name after a forward slash e.g “localhost/mywebsite“
That’s pretty cool, right?
Try this yourself and start a new hobby or project!
Here’s a list of some super useful keyboard shortcuts you can use while watching videos on Youtube. Become a speed user on Youtube and save time today!read more
An early stage of any marketing campaign is to define the target audience. Once you know who your customers are you can make an informed decision on how to market your business. Whether you use social media and pay per click advertisement; or leaflets and billboard advertisement, or both.read more
Since no one actually knows Google’s secret algorithm the best practice of optimising a website for search engines is using tested methods which usually work. Unsurprisingly, many people don’t know the first thing about crawling, bots, indexing or the practice of SEOread more