PDF download Download Article
Host a website locally on your computer for free using MAMP or LAMP
PDF download Download Article

Do you want to host a website yourself for free? There are plenty of web hosting companies to choose from, and some offer free hosting. However, free hosting services tend to have a lot of limitations, such as limited storage space, bandwidth, downtime, and lack of features. One way to get around this is to host your own website on your computer for free. You can do so using a free program called MAMP on Windows and Mac, or LAMP on Linux. MAMP and LAMP will create a local server on your computer that you can use to host your own website. This wikiHow article teaches you how to host your own website locally for free.

Things You Should Know

  • You can download and install MAMP to host a website for free on Windows and Mac.
  • You can install LAMP to host a website server on Linux. On Linux, you will need to install Apache, MySQL, and PHP separately using the Terminal.
  • There are also free web hosting services on the internet, although free web hosting has limitations.
Section 1 of 5:

Preparing to Host a Website

PDF download Download Article
  1. Many internet service providers (ISPs) expressly forbid personal hosting unless you have a business plan, which often costs significantly more than a standard use plan. This shouldn't be an issue if your site only generates a few hits per month, but any kind of significant traffic will draw attention to your hosting.
    • If your ISP prohibits home hosting, either upgrade your plan to one that allows hosting or switch to a different ISP before you continue.
    • Failing to heed your ISP's policy for home hosting can result in anything from getting your internet turned off to having to pay fines.
  2. In order to host a website, you must have a computer on and connected to the Internet 24 hours per day, seven days per week. This is easier to accomplish with a secondary, older computer than it is with your primary computer.
    • Restarting your computer to update will occasionally be necessary. During these updates, your website will be inaccessible.
    Advertisement
  3. Ensure your computer is up-to-date with the latest operating system, security features, and drivers. Make sure you update Windows , macOS , or your Linux system before continuing.
  4. This includes your HTML, CSS, and PHP files. You'll also need to move any media files, such as pictures and videos to your computer. If your website's source code isn't already in a file on your computer, copy it from your web service's settings into a text document on your computer and save it as a PHP or HTML file.
    • If the website's source code is stored on your computer, make sure you know where to find it.
    • If you haven't yet programmed your website , you'll need to do so before continuing.
    • The main webpage for your website should be saved as "index.html" or "index.php."
  5. Advertisement
Section 2 of 5:

Setting up Hosting on Windows

PDF download Download Article
  1. MAMP is a free website hosting application that works on both Windows and Mac machines. Use the following steps to download MAMP:
    • Go to https://www.mamp.info/en/ .
    • Click Free Download
    • Click the MAMP & MAMP PRO button below the Windows icon.
    • Wait for the installation file to finish downloading.
  2. It looks like a white elephant on a grey background. By default, your downloaded files can be found in your Downloads folder.
    • If prompted, click Yes on the Windows control access pop-up window.
  3. Use the following steps to do so:
    • Click Next on the Welcome page.
    • Uncheck the "MAMP PRO" box and click Next
    • Check "I accept the agreement" and click Next
    • Select an install location and click Next
    • Select a Start menu location and Next .
    • Check or uncheck "Create a desktop shortcut" and click Next .
    • Review the installation and Start menu location and click Install .
  4. While MAMP is installing, find the document on your computer that you pasted the website's source code into earlier. To do so:
    • Press Windows Key + E to open File Explorer.
    • Open the Document's folder.
    • Select the document by clicking it.
    • Press Ctrl + C to copy it.
  5. It resembles a white elephant on a grey background.
    • Make sure you aren't clicking the setup icon here.
    • If you see a warning about port 80 appear; click Cancel on the warning window to dismiss it.
    • If Windows Defender asks if you want to allow access to MAMP, click Allow Access .
  6. It's the first option in the menu bar at the top.
  7. This gear-shaped icon is on the left side of the MAMP window. Doing so opens the Preferences window.
  8. It's at the top of the Preferences window.
  9. It's at the bottom of the page next to "Set Web and MySQL ports to:"
  10. It's at the top of the Preferences window.
  11. This button is near the bottom of the window.
  12. The source code document will appear in the MAMP root folder. This is the location where you can store your website files.
  13. This will save your settings.
  14. To do so, click the MAMP button and then click Exit . Then double-click the MAMP icon to restart it.
  15. If MAMP's servers don't start automatically, click Start Servers . It's on the right side of the MAMP window. Doing so will start the MAMP server with your website's source code and port preferences. Your website should now be live; people will be able to access it by entering your public IP address into a search engine. You can also add a domain name to make your website easier to access.
    • Unless you pay for a static IP service, your local IP address—and, by extension, your website's address—will change from time to time.
    • You cannot use your local IP address to view the website from your own network, since entering it will just take you to your router's page.
  16. Advertisement
Section 3 of 5:

Setting up Hosting on Mac

PDF download Download Article
  1. In order to download the correct version of MAMP, you will need to know what type of processor your Mac has. You can find out what your Mac model is by clicking the Apple icon and clicking About this Mac . Most older Mac models have Intel processors. The following Mac models have Apple Silicon chips: [1]
    • MacBook Pro (2021 or later).
    • MacBook Pro (13-inch, M1, 2020 later).
    • MacBook Air (2022 or later).
    • MacBook Air (M1, 2020 or later).
    • iMac (2021 or later).
    • Mac mini (2020 or later).
    • Mac Studio (2022 or later).
    • Mac Pro (2023 or later).
  2. MAMP is a free website hosting application that works on both Windows and Mac machines. To download MAMP:
    • Go to https://www.mamp.info/en/ .
    • Click Free Download
    • Click the MAMP & MAMP PRO (Intel) if you have an Intel processor. Click MAMP & MAMP PRO (Apple) if you have an Apple Silicon processor.
    • Wait for the file to finish downloading.
  3. It is a ".pkg" file with an icon that resembles a brown box.
    • If you receive a warning message that says the file can't be opened, verify the download before continuing.
  4. Use the following steps to do so:
    • Click Continue on the introduction page.
    • Click Continue on the "Read Me" page.
    • Click Continue on the License agreement page.
    • Click Agree .
    • Click Install .
    • Enter your Mac's username and password, then click Install Software .
  5. This process will likely take around five minutes.
    • Click Ok on any prompts the installer requests access to.
  6. It's the icon that resembles a blue and white smiley face. It's in the dock at the bottom of the screen.
  7. Click the folder in which the source code document that you copied or created earlier is located.
    • You may have to click through several folders to get to the document, depending on where you saved it.
  8. Hold Shift and click the documents and folders to select them, then click Edit and click Copy .
  9. Click the MAMP icon, which resembles a white elephant on a grey background. You can find it in the Applications folder.
    • If you can't find MAMP, click the magnifying glass icon in the upper-right corner and type "MAMP" in the search bar.
  10. This gear-shaped icon is on the far-left side of the MAMP window.
    • If you receive an error window, first click OK to exit the window.
  11. It's at the top of the Preferences window.
  12. You'll find this at the bottom of the page next to "Set Web and MySQL ports to:"
  13. It's the third tab at the top of the page.
  14. This will open the server location in Finder.
  15. This folder will be the location of your website and all of its files.
  16. It's at the bottom of the page. This saves your settings.
  17. To do so, click MAMP in the menu bar at the top and then click Quit MAMP .
  18. It's on the right side of the MAMP window. Doing so will start the MAMP server with your website's source code and port preferences. Your website should now be live; people will be able to access it by entering your public IP address into a search engine. You can also add a domain name to make your website easier to access.
    • Unless you pay for a dynamic IP service, your local IP address—and, by extension, your website's address—will change from time to time.
    • You cannot use your local IP address to view the website from your own network, since entering it will just take you to your router's page.
  19. Advertisement
Section 4 of 5:

Using Linux Ubuntu

PDF download Download Article
  1. 1
    Press Ctrl + Alt + T to open the Terminal. You can install LAMP on Linux using the Terminal. The Terminal has an icon that resembles a black screen with a white cursor. You can click the Terminal icon in the Apps menu, or use the keyboard shortcut to open the Terminal.
  2. 2
    Update the software repository. Before you begin, make sure the software repository is up-to-date. To do so, enter the following command and press Enter .
    • sudo apt update .
  3. 3
    Install Apache. Apache is the HTTP server software you will be using. To install Apache, enter the following command and press Enter :
    • sudo apt install apache2 -y
  4. 4
    Check if Apache is installed correctly. The Apache server status should start running automatically. When you check the server status, it should return the output "Active: (running)" next to "Active." Enter the following command and press Enter to check the server status:
    • sudo service apache2 status
    • Press Ctrl + C to exit the service status screen.
  5. 5
    Check to make sure the UFW firewall has the Apache profiles. When you check the UFW firewall, it should return "Apache Full" as the output. Enter the following command and press Enter to check the Apache profile:
    • sudo ufw app list
  6. 6
    Check that the Apache Full profile allows traffic on Ports 80 and 443. When you enter the following command, it should return "80, 443/tcp" below "Ports." Enter the following command and press Enter .
    • sudo ufw app info "Apache Full"
  7. 7
    Go to localhost in a web browser. All you need to do is open a web browser and type "localhost" in the address bar. This should display the Apache Ubuntu default page with the message "It works."
  8. 8
    Install MySQL. MySQL is a relational database system. Enter the following command and press Enter to install MySQL:
    • sudo apt install mysql-server -y
  9. 9
    Install PHP. PHP is a server-side scripting language that integrates well with MySQL. PHP is usually the final layer of LAMP (Linux, Apache, MySQL, and PHP). Enter the following command and press Enter to install PHP:
    • sudo apt install php libapache2-mod-php php-mysql -y
  10. 10
    Modify the Apache server files. By default, Apache looks for an "Index.html" index file. Modify the "dir.conf" file so that Apache looks for the "Index.php" file instead. Use the following steps to do so:
    • Type sudo nano /etc/apache2/mods-enabled/dir.conf and press Enter .
    • Delete "index.php" in the line after "DirectoryIndex."
    • Re-enter "index.php" first after "DirectoryIndex" and before "index.html."
    • Press Ctrl + X .
    • Press y .
  11. 11
    Install additional PHP modules (optional). If you want to install additional PHP modules, type apt-cache search php- and press Enter to see a list of all available modules along with a short description of each. Use the arrow keys to navigate the list. Type the name of a module and press Enter to see a full description. To install a module, type sudo apt install [module name] and press Enter . [2]
  12. 12
    Copy your website source code file. To do so, open the Files app and navigate to where you have the source code files for your website saved. Right-click the documents and folders and click Copy .
  13. 13
    Navigate to the Apache Index folder. Use the following steps to do so:
    • Open the Files app.
    • Click Other locations in the menu bar to the left.
    • Click Computer .
    • Click var .
    • Click www .
    • Click html .
  14. 14
    Paste your web page source code files. To do so, right-click and click Paste . This pastes your website files into the Apache server folder. This is the folder where you can save your website pages and files.
    • Your website should now be live; people will be able to access it by entering your public IP address into a search engine. You can also add a domain name to make your website easier to access.
  15. Advertisement
Section 5 of 5:

Adding a Domain Name

PDF download Download Article
  1. 1
    Register a domain name. If you want people to access your local website using a domain name instead of your public IP address, you will first need to register a domain name . You can do so using services like GoDaddy.com , Namecheap.com , Domain.com , HostGator.com , Bluehost.com , Sauarespace.com , and more. [3]
  2. 2
    Log in to your domain registrar website. Go to the website you used to purchase your domain name. Log in with the username and password associated with your account.
  3. 3
    Select the option to manage domains. Your domain registrar should have an option that allows you to manage your domain names. Click this option.
  4. 4
    Click the DNS section for your domain name. This will probably be a button that says DNS , DNS settings , or similar below your domain name. Click the option to modify the DNS settings for your domain name.
  5. 5
    Click the option to add a DNS record. This will be a button that says Add , Add Record , or something similar.
  6. 6
    Select an "A" type record. This is the type of record that points a domain name to an IP address.
    • If you are using an IPv6 address, select an "AAAA" type record instead.
  7. 7
    Type @ as the host. The "@" is a shorthand for the domain name. For example, if your domain name is "www.mywebsite.me", the "@" symbol is shorthand for the "mywebsite.me" portion of the domain name.
  8. 8
    Add your public IP address to the record. This goes in the field that indicates what the host points to. Just enter the numeric portion of your IP address with the dots (.). You don't need to add "http://" or "https://" or anything like that.
  9. 9
    Add another record. To do so, click the button to add a new record and select an "A" type record, or an "AAAA" type record for an IPv6 address.
  10. 10
    Type www as the host. This will create a record for your full domain name. For example, if your domain name is "www.mywebsite.me", this will create a record for the entire domain name.
  11. 11
    Add your public IP address to the record. This goes in the field that indicates what the host points to. Just enter the numeric portion of your IP address with the dots (.).
  12. 12
    Save the records. To do so, click the button that says Save or Add Records or similar. This will save both records with your domain name pointing to your public IP address. Internet users can access your website by typing the domain name into their web browser. [4]
    • Allow 24 hours for the domain records to be updated and to take effect.
  13. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How do I host a webpage on a purchased domain?
    Michele
    Top Answerer
    The server where you bought the domain probably offers hosting services but usually at a cost. If you want to do it for free, have your domain redirected to whatever free web service you decide to use for your website. Remember, free sites are limited in the number of pages and can have a lot of ads. On the other hand, hosting your own website as in Method 2 above, or having your site hosted where you bought and keep the domain, allows you to pretty much create as many pages as you want, without any advertising you don't put up for yourself.
  • Question
    What should I do if when I put in the IP address but it says, "invalid IP address"?
    Community Answer
    Check if you got the IP correct; IPv4 changes once in a while when wireless.
  • Question
    Can I still add or edit things to my HTML website after I've already published it?
    Michele
    Top Answerer
    Websites can always be edited, as many times as you like. You just have to go back into whatever you used to create the website, edit it, then republish it.
See more answers
Ask a Question
      Advertisement

      Tips

      • While MAMP gives you the option of resetting its ports automatically, you can also manually open port 80 in your router's firewall.
      • Web hosting is incredibly cheap (some services come in at under $4 per month), and web-hosting services offer protection from attacks that personal hosting may not be able to fend off. As such, web hosting is a far better route than home hosting if you're able to spare an extra few bucks per month.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      • For self-hosted sites, your site will go down if you lose your internet connection, your computer loses power, or your system crashes.
      • Note that if you host your website on your PC, your site is likely to respond more slowly than traditionally hosted sites.
      Advertisement

      About This Article

      Thanks to all authors for creating a page that has been read 1,227,543 times.

      Reader Success Stories

      • Matthew

        Jul 9, 2016

        "These editors did a fantastic job in writing what is the most clear and conclusive guide to hosting my own website. ..." more
      Share your story

      Is this article up to date?

      Advertisement