How to Create Your Own Webserver (with Images)

Table of contents:

How to Create Your Own Webserver (with Images)
How to Create Your Own Webserver (with Images)
Anonim

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

Create a Web Host in Your Home Step 1
Create a Web Host in Your Home Step 1

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

Create a Web Host in Your Home Step 2
Create a Web Host in Your Home Step 2

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.

Create a Web Host in Your Home Step 3
Create a Web Host in Your Home Step 3

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

Create a Web Host in Your Home Step 4
Create a Web Host in Your Home Step 4

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

Create a Web Host in Your Home Step 5
Create a Web Host in Your Home Step 5

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

Create a Web Host in Your Home Step 6
Create a Web Host in Your Home Step 6

Step 3. Wait for the download to finish

Once you have downloaded the MAMP installation file, you can continue.

Create a Web Host in Your Home Step 7
Create a Web Host in Your Home Step 7

Step 4. Double-click the MAMP installation file

The installation window will open.

On Mac, this is a PKG file

Create a Web Host in Your Home Step 8
Create a Web Host in Your Home Step 8

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.

Create a Web Host in Your Home Step 9
Create a Web Host in Your Home Step 9

Step 6. Wait for the installation to finish

At that point you can start configuring MAMP.

Part 3 of 6: Configure MAMP

Create a Web Host in Your Home Step 10
Create a Web Host in Your Home Step 10

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

Create a Web Host in Your Home Step 11
Create a Web Host in Your Home Step 11

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

Create a Web Host in Your Home Step 12
Create a Web Host in Your Home Step 12

Step 3. Click Yes when asked

This will allow MAMP to use the selected port.

Create a Web Host in Your Home Step 13
Create a Web Host in Your Home Step 13

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

Create a Web Host in Your Home Step 14
Create a Web Host in Your Home Step 14

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).

Create a Web Host in Your Home Step 15
Create a Web Host in Your Home Step 15

Step 2. Click Preferences…

You will find this button on the left side of the MAMP window. Press it and a window will open.

Create a Web Host in Your Home Step 16
Create a Web Host in Your Home Step 16

Step 3. Click the Web Server tab

You'll see it at the top of the window that just opened.

Create a Web Host in Your Home Step 17
Create a Web Host in Your Home Step 17

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

Create a Web Host in Your Home Step 18
Create a Web Host in Your Home Step 18

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.

Create a Web Host in Your Home Step 19
Create a Web Host in Your Home Step 19

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.

Create a Web Host in Your Home Step 20
Create a Web Host in Your Home Step 20

Step 7. Save the document

Press Ctrl + S (Windows) or ⌘ Command + S (Mac) to do this.

Create a Web Host in Your Home Step 21
Create a Web Host in Your Home Step 21

Step 8. Close the document and folder

You should return to the MAMP "Preferences" window.

Create a Web Host in Your Home Step 22
Create a Web Host in Your Home Step 22

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

Create a Web Host in Your Home Step 23
Create a Web Host in Your Home Step 23

Step 1. Click Start Servers

It is located on the right side of the window.

Create a Web Host in Your Home Step 24
Create a Web Host in Your Home Step 24

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.

Create a Web Host in Your Home Step 25
Create a Web Host in Your Home Step 25

Step 3. Click the My Website tab at the top of the page

Your website will open.

Create a Web Host in Your Home Step 26
Create a Web Host in Your Home Step 26

Step 4. Check your site

Scroll the page to view it in its entirety.

Create a Web Host in Your Home Step 27
Create a Web Host in Your Home Step 27

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

Create a Web Host in Your Home Step 28
Create a Web Host in Your Home Step 28

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

Create a Web Host in Your Home Step 29
Create a Web Host in Your Home Step 29

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.
Create a Web Host in Your Home Step 30
Create a Web Host in Your Home Step 30

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".

Create a Web Host in Your Home Step 31
Create a Web Host in Your Home Step 31

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.

Create a Web Host in Your Home Step 32
Create a Web Host in Your Home Step 32

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.

Create a Web Host in Your Home Step 33
Create a Web Host in Your Home Step 33

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.

Recommended: