This article teaches you how to host a website on your home network using a free program called MAMP.
Steps
Part 1 of 6: Preparing to Host a Website
Step 1. Make sure your ISP (Internet Service Provider or Internet Service Provider) allows hosting
Local hosting is usually allowed regardless of your ISP's policy, while creating a website that attracts a lot of traffic can violate the terms of use of your internet service agreement.
In many cases, you will be able to upgrade to a "Business" (or similar) pricing plan to get support for large-scale hosting
Step 2. Create your website source code if needed
If you don't have a web document to use as your home page, you'll need to create one.
Step 3. Install a text editor which can handle PHP documents
Depending on the operating system of your system, you have several options available:
- Windows - Notepad ++ is the best choice.
- Mac - You can download a free text editor called "BBEdit" at this address. Click Free Download on the right side of the page.
Part 2 of 6: Install MAMP
Step 1. Open the MAMP website
Go to this address with your computer's browser.
Make sure you are using the computer on which you will create the webserver
Step 2. Choose a download option
Click MAMP & MAMP PRO 4.0.1 for the Windows version of MAMP or MAMP & MAMP PRO 5.0.1 for the Mac version. The download of the program installation files will start.
If necessary, confirm the download or select a save location
Step 3. Wait for the download to finish
Once you have downloaded the MAMP installation file, you can continue.
Step 4. Double-click the MAMP installation file
The installation window will open.
On Mac, this is a PKG file
Step 5. Follow the installation instructions on the screen
The directions vary depending on your computer's operating system, but be sure to uncheck the "Install MAMP Pro" box during the process.
Step 6. Wait for the installation to finish
At that point you can start configuring MAMP.
Part 3 of 6: Configure MAMP
Step 1. Open MAMP
Double-click the gray elephant icon. The MAMP dashboard window should appear.
On Mac, you can find the MAMP app icon in the "Applications" folder
Step 2. Click Use the next free port when prompted
In this way the program will be able to skip port 80 and use the next free one.
In almost all cases, MAMP will use port 81 when port 80 is not free
Step 3. Click Yes when asked
This will allow MAMP to use the selected port.
Step 4. Confirm all Firewall requests
If you are using a Windows computer, the Firewall will ask you to allow Apache and MySQL traffic. Click Allow in both windows before proceeding.
Skip this step on Mac
Part 4 of 6: Uploading Your Website
Step 1. Copy the source code of your website
Open the document that contains it, select the text and press Ctrl + C (Windows) or ⌘ Command + C (Mac).
Step 2. Click Preferences…
You will find this button on the left side of the MAMP window. Press it and a window will open.
Step 3. Click the Web Server tab
You'll see it at the top of the window that just opened.
Step 4. Click Open in the center of the window
The "htdocs" MAMP folder will open.
On Mac, click the folder icon to the right of the "Document Root" header
Step 5. Open the "index.php" file
Right-click on it, then click Edit with Notepad ++ in the menu that appears.
On Mac, click once on the "index.php" file, click File, select Open with, finally click the item BBEdit. If that doesn't work, open BBEdit, then drag the "index.php" file into the program window.
Step 6. Replace the contents of the "index.php" file with your own source code
Press Ctrl + A (Windows) or ⌘ Command + A (Mac) to select all the text within the document, then press Ctrl + V or ⌘ Command + V to paste your website's source code.
Step 7. Save the document
Press Ctrl + S (Windows) or ⌘ Command + S (Mac) to do this.
Step 8. Close the document and folder
You should return to the MAMP "Preferences" window.
Step 9. Click OK at the bottom of the window
You will save the settings and close the window.
Part 5 of 6: Accessing the Website
Step 1. Click Start Servers
It is located on the right side of the window.
Step 2. Click Open start page
You will see this option on the left side of the window. Press it and the MAMP startup page will open in your default web browser.
Step 3. Click the My Website tab at the top of the page
Your website will open.
Step 4. Check your site
Scroll the page to view it in its entirety.
Step 5. Check your website address
You can find it in the address bar at the top of your browser and it should look something like "localhost: 81". This is the address you will need to enter to access your site from the current network when MAMP is running.
Part 6 of 6: Viewing Your Website from Another Computer
Step 1. Make sure your website is online
To access it, MAMP must be running on the host computer.
You cannot connect to your website if MAMP is not started or if the host computer is turned off
Step 2. Set a static IP address for the host computer
In this way you will be sure that the system address will not change and that consequently the access mode to the website remains constant over time:
- Open your router page;
- Log in if necessary;
- Find the list of computers currently connected;
- Find your computer name;
- Select the option Book or Block next to your computer's IP address.
Step 3. Forward MAMP's "Apache" port on your router.
To do this you will need to open the "Port Forwarding" section of the device, add the port you used for Apache during the MAMP configuration and save the settings.
You can see the port used by Apache by clicking Preferences … in the MAMP dashboard, by clicking on the tab Ports and looking at the number next to "Apache".
Step 4. Find the public IP address of your host computer
The easiest way to do this is to open Google, type what is my ip and press Enter. You should see your computer's public IP before search results.
Step 5. Use a computer on a different network
To avoid conflicts between the local host on your network and the public IP address, try connecting to your website using a different system than the host, connected to the internet on another network.
Step 6. Open your website
Using a computer connected to another network, open a web browser, enter the public IP address of the host computer, add a colon (:), write the Apache port number and press Enter. The website should open.
For example, if your computer's public IP address is "123.456.78.901" and you are using port 81 for Apache, you would type 123.456.78.901:81 before pressing Enter
Advice
- Better to use an old computer as a web server.
- If possible, connect the host computer to the router with an Ethernet cable.