Today, Mytour will guide you through the process of setting up your own web server on your computer. Whether you’re using a Windows PC or a Mac, you can achieve this by using the MAMP server software. However, before proceeding, you’ll need to ensure your computer meets the necessary requirements to host a server.
Steps
Preparing to Host a Website

Ensure your Internet service agreement allows hosting. Many Internet service providers strictly prohibit personal hosting unless you subscribe to a business plan, which is significantly more expensive than basic packages. While it might not be an issue if your website receives only a few visits per month, significant traffic will likely draw attention to your hosting activities.
- If your ISP doesn’t allow personal hosting, consider upgrading to a plan that permits website hosting or switching to a different provider before proceeding.
- Failing to comply with your ISP’s hosting policies could result in service termination or penalties.

Ensure your equipment is capable of hosting. To host a website, your computer must remain powered on and connected to the Internet 24/7. This process is easier if you have a secondary, older computer dedicated to hosting, while your primary computer is used for work.
- Occasionally, you’ll need to restart your computer for updates. During this time, your website will be inaccessible.

Update your computer. Make sure your computer is running the latest operating system, features, and drivers. You’ll need to update your computer (Windows or Mac) before proceeding.

Transfer your website’s source code to your computer. If the website’s source code isn’t already saved as a file on your computer, copy it from your web service’s settings and paste it into a text document, then save it as a PHP file.
- If the source code is already saved on your computer, ensure you know the file’s location.
- If you haven’t programmed your website yet, you’ll need to do so before continuing.

Download the MAMP program. MAMP is a free web hosting application that works on both Windows and Mac computers. To download MAMP:
- Visit https://www.mamp.info/en/.
- Click DOWNLOAD under the "Free" version.
- Click the orange Download button.
- Wait for the file to download.
Setting Up the Server on Windows

Double-click the MAMP setup icon featuring a white elephant on a gray background.

Click Yes when prompted. The MAMP installation program will launch.

Complete the installation process by:
- Selecting your language and clicking OK
- Clicking Next
- Unchecking the "MAMP PRO" box and clicking Next
- Checking the "I accept" box and clicking Next
- Clicking Next three times, then selecting Install
Access the folder containing your website’s source code.


the source code document. Press the Ctrl and C keys simultaneously to copy the selected source code document.

Double-click the MAMP icon featuring a white elephant on a gray background.
- Ensure you’re not clicking the setup icon here.

Click OK when prompted. A warning about port 80 will appear; clicking OK will dismiss this message.

Click Preferences… (Settings). This gear icon is located on the left side of the MAMP window. The Preferences window will open.

Click the Ports tab at the top of the Preferences window.

Click Set MAMP ports to default. This button is located in the middle of the page. The ports used by MAMP will reset to default, resolving the earlier port 80 issue.

Click the Web Server tab. This tab is at the top of the Preferences window.

Click the Open button near the bottom of the window.

Paste the source code document into the folder by pressing Ctrl + V. The source code document will appear in the main MAMP folder.

Click OK in the MAMP window. Your settings will be saved.

Close and reopen MAMP. Click the Quit option in the bottom-left corner of the MAMP window, then double-click the MAMP icon to relaunch the program.

Click Start Servers. This option is on the right side of the MAMP window. The MAMP server will start with your website’s source code and port settings. Your website will be live; others can access it by entering your public IP address into their browser.
- Unless you purchase a dynamic IP service, your local IP address and website URL may change over time.
- You cannot use the local IP address to view the website if connected to your home network, as it will redirect to the router’s page.
Setting Up the Server on Mac

Double-click the brown MAMP setup file.
- If you receive a warning that the file cannot be opened, verify the download before proceeding.

Complete the MAMP installation by:
- Clicking Continue on each of the first three pages.
- Clicking Agree
- Selecting Install for all users of this computer, then clicking Continue
- Clicking Install
- Entering your Mac’s username and password, then clicking Install Software

Wait for MAMP to finish installing. This process may take around 5 minutes.
Open Finder. Click the blue face icon application on your Mac’s Dock.

Locate your website’s source code document. Click the folder where you previously saved or created the source code file.
- You may need to navigate through multiple folders to find the document, depending on where it was saved.

the document. Click the document to select it, then click Edit and choose .

Click the Applications folder on the left side of the Finder window.

Double-click the MAMP folder inside the Applications folder.

Double-click the htdocs folder. This folder is located within the MAMP directory and is where website resources, including source code documents, are stored.

Paste the source code document into this folder. Click Edit and select Paste Item.
Open MAMP.MAMP

Click Preferences…. This gear icon is located on the left side of the MAMP window.
- If you encounter an error message, first click OK to close the window.

Click the Ports tab at the top of the Preferences window.

Click the Set to default button. This option is located in the middle of the Ports section. The ports used by MAMP will reset, ensuring your website isn’t blocked by the router’s default firewall.

Click OK at the bottom of the page. Your settings will be saved.

Close and reopen MAMP. Click Quit, then click the MAMP icon again to relaunch the program.

Click Start Servers on the right side of the MAMP window. The MAMP server will start with your website’s source code and port settings. Your website will go live; others can access it by entering your public IP address into their browser.
- Unless you purchase a dynamic IP service, your local IP address and website URL may change over time.
- You cannot use the local IP address to view the website if connected to your home network, as it will redirect to the router’s page.
Tips
- While MAMP offers an automatic port reset option, you can also manually open port 80 on your router’s firewall.
- Web hosting services are very affordable (some cost less than 100,000 VND/month). These services also provide better protection compared to self-hosting. Therefore, web hosting is a much better option if you have a monthly budget for it.
Warnings
- When self-hosting, your website may go down if your computer loses internet connection, experiences a power outage, or encounters system errors.
- Note that self-hosting on your computer will result in significantly slower website response times compared to using traditional web hosting services.
