Jump to content

Recommended Posts

Posted

Want to use your own computer as your host server? It isn't that hard, although there are many things to consider first. You can use a computer specifically for this, or use your everyday computer, even a laptop. You can either use it as a means of testing your website

or allow it to be public.

Preparation

You will need a fast Internet connection (Note: upload speed is all that counts), the more people you expect to be viewing your site, the faster the connection you will need. If your upload speed is say 1Mbps, then that means no one else who views your site will be able to view your site at any speed higher than 1Mbps. If two people are downloading from your site at the same time, they will have to share your upload speed. Also consider monthly limits.

Read your ISP's terms of service and/or ask at their help desk, to see if they allow web hosting through your connection, not all do.

Keep in mind that your website will only be viewable when your computer is turned on and connected to the Internet. So you will probably want this to be 24/7.

Make sure that your IP address is static, not dynamic.

There are security risks associated with hosting your own website. If someone breaches your site's security, keep in mind the data they are changing is stored on your computer. This isn't usually a big concern unless you use badly made PHP scripts.

Setting up XAMPP

XAMPP contains Apache (Web server software), PHP (A server-side scripting language), MySQL (A databasing system), FileZilla Server (Server-side FTP software) and Mercury (An email system). We'll be using all but Mercury. Here's how to set it up.

1. Download the zipped version of XAMPP.

2. Unzip XAMPP (This guide will assume you unzipped it at C:\, placing the root directory of XAMPP at C:\xampp).

3. Run the batch file called setup_xampp.bat.

4. Create a shortcut to xampp-control.exe and place it in your start menu and/or on your desktop.

Turning on XAMPP

You need to turn on XAMPP (More specifically Apache, MySQL and FileZilla Server; PHP is an extension to Apache, so doesn't need turning on) every time you turn on your computer, otherwise they cannot be used. Here's how.

1. Open the XAMPP Control Panel (xampp-control.exe).

2. Click start for Apache and MySQL to allow your website to be viewed.

3. Click start for FileZilla to allow the modification of your website from other computers with FTP.

4. Close XAMPP (It will minimise to a tray icon) or click exit to competely close it. Note: closing XAMPP does not close Apache, MySQL and FileZilla, they must be exited separately.

Tip: to make this all happen by itself on start up, make apache_start.bat, mysql_start.bat and filezilla.bat start on start up.

Modifying your website

To modify your website, simply change the files stored at C:\xampp\htdocs, that is your website. You can remove/modify index.php, index.html and favicon.ico at will, but all other files should remain in tact. Alternatively you can access your computer via FTP, after setting it up.

To test your website, you can view it at http://localhost/ or http://127.0.0.1/, but only on the computer that XAMPP is installed. You can access phpMyAdmin at /phpmyadmin.

Adding security

XAMPP is setup by default with security settings for if the computer is not connected to the Internet, for testing purposes of developers. These changes are required to add enough security to put it on the Internet.

1. Go to http://localhost/security.

2. Set a password for the root MySQL user, one that you will easily remember, but no one else knows (Since the root user is the most powerful MySQL user).

3. Set a user and password for the XAMPP directory (If you don't want to remember two usernames/passwords, you can make them the same as the MySQL root user).

4. Set phpMyAdmin authentication to cookies.

5. Change the default FTP user/password (Explained below).

Changing FTP users

FTP settings can be changed and should be, from the default, for security reasons. Here's how.

1. Open the XAMPP Control Panel.

2. Click admin for FileZilla.

3. Go to Edit > Users.

4. Select users from the right listbox and make sure every non-anonymous user has a password.

5. Close the FileZilla window.

Setting up port forwarding

If you use a router for your computer, you will need to setup port forwarding, in order for other computers to be able to access your website. This is because IP addresses are assigned to routers, not computers.

1. Consult your router's user manual for how to setup port forwarding (Every router is different).

2. Make your computer's internal IP address static (Sub-instructions are for Vista, but probably similar for XP):

a) Go to Control Panel > Network and Internet > Network and Sharing Center > Manage network connections.

B) Right-click the network that is associated with your router and select properties.

c) Select Internet Protocol Version 4 (TCP/IPv4) and select properties.

d) Select 'use the following IP address'.

e) Check your current internal IP address settings:

i. Go to Start > Run (XP Only) > Type 'cmd' and press enter.

ii. Type 'ipconfig' and press enter.

iii. Check IPv4 Address, Subnet Mask and Default Gateway.

f) Enter your settings into the other window you have open.

g) Check your DNS server settings via your router and/or router's manual and enter them.

3. Add a port forwarding rule for the port 80 (For HTTP) to the internal IP address you just set (The one that is not the subnet mask, the default gateway or the DNS server IP addresses and a port 21 (For FTP) to the same internal IP address.

4. If done correctly, other computers should be able to view your site via your IP address (Check your IP address).

5. To allow access to your website via a domain, set one up to work with your IP address.

Note: XAMPP isn't intended for hosting an actual application. It's intended for development, and it's quite insecure.

Yes! it is insecure for your own computer to. The intention behind posting this was purely for educational purposes. You can use it if you have a small group of people. I recommend to use it as a means for testing and

developing your projects.

Source

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...