Jump to content
Daedalus

Setting up your website locally [Windows]

Recommended Posts

So you want to host your own website on your server?
This tutorial will explain the basics of setting up a website, plus some insights of benefits of hosting your own website.
[B]Note:[/B] This tutorial is for the intention of your website and .htaccess, you have come to the wrong place if your expecting some coding related help (IE PHP).

.:: Legend ::.
Setting up your website
- Altering httpd.conf
-- Changing permissions to access certain directories
-- Changing default port
- Altering php.ini
-- Suppressing errors
-- Limiting connections for MySQL
Masking links/files
Forbidding access to your website
Customizing error pages


[spoiler=Setting up your website]

[spoiler=Installing xampp]
There are a few things you must know in hosting locally;

1. Hosting a server locally can carry risks, IE DDOSers/Hackers, so make sure you have a good system and anti-ddos etc.
2. It isn't wise to host a website on the server you run your game servers on, as for obvious reasons if the virtual machine goes down, both will obviously be down.
3. In a lot of cases, people host a website on an alternative host, though if you don't have the cash, or if you want the website to be hosted locally for other reasons, then this would be the option.

Lets get started.

First off download [URL="https://www.apachefriends.org/download.html"]Xampp [/URL]

Follow the instructions below;

[B]Step 1 (Selecting what to install):
[/B][IMG]http://ragekit.co.uk/rl_tutorials/web_create/xampps1.png[/IMG]

Id not recommend installing Filezilla server itself unless you intend to send files to your website host via another computer.



[B]Step 2 (Choose directory; this isn't mandatory.):
[IMG]http://ragekit.co.uk/rl_tutorials/web_create/xampps2.png[/IMG][/B]

And then simply click next through all the rest until installed.[/spoiler]

[spoiler=Altering httpd.conf]
Open httpd.conf via left-clicking the Xampp icon down in the task menu bar, and opening the Apache window.

[spoiler=Changing permissions to access certain directories]
This picture will give you an idea of allowing or denying access to a certain directory or root directory of the website, as per example in the image, C:/wamp/www/mcadmin is a directory to which is denied access, though currently commented out.
[IMG]http://ragekit.co.uk/rl_tutorials/web_create/httpd_docrootallowdeny.png[/IMG]
[/spoiler]

[spoiler=Changing default port]
This other picture is an example of changing ports for the website connections, the default port is 80, though you may change this port to any number to connect with (I wouldn't recommend using the following ports; 21 or 3306 - [URL="http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers"]See list of common ports in use[/URL]), so if you change the default port to 1234 you would connect as per example; 12.345.67.89:1234
[IMG]http://ragekit.co.uk/rl_tutorials/web_create/httpd_port.png[/IMG]
[/spoiler]The pictures are pretty much self explanatory.
[COLOR=#ff0000][B]If you make any changes to the httpd.conf then save and reload the webhost server.[/B][/COLOR]
[/spoiler]
[spoiler=Altering php.ini]
Open php.ini via left-clicking the Xampp icon again, and go to PHP.

[spoiler=Suppressing errors]
The picture below shows how to suppress errors or show them, including warnings.

[IMG]http://ragekit.co.uk/rl_tutorials/web_create/phpdotinierror_reporting.png[/IMG]

I personally use [B]E_ALL & ~E_NOTICE

[/B]So for example, change [B]error_reproting = E_ALL [/B]to [B]error_reporting = E_ALL & ~ E_NOTICE[/B]
[/spoiler]

[spoiler=Limiting connections for MySQL]

The next picture is probably the most important, if you are running from a virtual machine, and wish to limit the connections to the MySQL databases, you can do so as example, though if you have a decent VPS or a dedicated server then if you want to, you may leave this.

[IMG]http://ragekit.co.uk/rl_tutorials/web_create/phpdotinimysqlmaxcon.png[/IMG]
[/spoiler]

[/spoiler]
[B]Port 80 is already in use by Skype, what should can I do?[/B]
There is no way to change its port, just make sure Skype isn't running in the background if you wish to use port 80, though I wouldn't know who would use Skype on their own virtual machine

[B]I can't connect to my website via my computer, what's gone on![/B]
In all likely hood, you haven't allowed Xampp's web server past your firewall (httpd.exe), this is a simply solution;

First off, open Control Panel, navigate to Windows Firewall.
Either allow the program to open the necessary ports, or open the port through Advanced Settings.
Port 80 (obviously), TCP protocol.

[B]How do I know if others can connect to my website?
[/B]Well, you will know either by loading the website up from your own computer, or go to [URL="http://www.yougetsignal.com/tools/open-ports/"]Yougetsignal[/URL] and check through there, or for shorter/faster way, go to [URL="http://isup.me"]isup.me[/URL] (This link will only work for default port 80)


[/spoiler]


[spoiler=Masking links/files]
[B]Note:[/B] Before continuing on this, make sure the following apache module is enabled, see image below for example;
[IMG]http://ragekit.co.uk/rl_tutorials/web_create/apacherewritemodule.png[/IMG]

If you wish to mask your pages, basically to replace index.php?i=example with i=example then create a .htaccess file in the directory of your files you wish to mask, and place the following example below;

[code]
Options +FollowSymlinks
RewriteEngine on

RewriteRule i=(.*)$ name_of_page.php?teststring=$1
[/code]
So, for the pretty much basics;

The file [B]name_of_page.php[/B]
[php]
<?php echo $_GET["teststring"];?>
[/php]
This file will give you the output of the string in question
[/spoiler]

[spoiler=Forbidding access to your website]
If you want to block access to certain people, you may do so from this example, though this is a very very basic method, people can easily find their ways around being blocked.

Again, open/create .htaccess in the directory, preferably root directory.


[B]Basic method to blocking a specific IP[/B]
[code]Order Allow,Deny
Deny from 12.345.67.89
Allow from all[/code]

[B]This example will explain how to block the range of an IP from 0 to 255[/B]
[code]
Order Allow,Deny
Deny from 12.345.67.0/24
Allow from all[/code]
[/spoiler]

[spoiler=Customizing error pages]
This is pretty basic in how to change those pages, whether it be 404/500/403
once Again, open/create .htaccess in the directory, preferably root directory.

[B]Page not found 404[/B]
[code]
ErrorDocument 404 /no_page.html
[/code]
[U]Make sure the redirected page starts with "/" excluding the quotes.[/U]
This method can be repeated with any of the error pages.
[/spoiler]
This concludes the basics to creating a website on your virtual machine!

I hope this is found to be useful, any inputs are welcome if I have missed anything out. (Writing this straight after work = tiresome.)

[I]If there are any typos/incorrect context, then I apologise, half asleep here :L[/I] Edited by Daedalus

Share this post


Link to post
Share on other sites
Pretty decent guide. Now you should work on making one using Cpanel

[COLOR="silver"]- - - Updated - - -[/COLOR]

Pretty decent guide. Now you should work on making one using Cpanel

Share this post


Link to post
Share on other sites
Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol

[COLOR="silver"]- - - Updated - - -[/COLOR]

Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol

Share this post


Link to post
Share on other sites
Hopefully he means setting up cPanel, because there's practically no effort in buying a web-host with cPanel already installed. Anyway, look into [URL="http://www.zpanelcp.com/"]zPanel[/URL], it's pretty much the same thing, but it's free. Could be useful for part of the tutorial bit.

[COLOR="silver"]- - - Updated - - -[/COLOR]

Hopefully he means setting up cPanel, because there's practically no effort in buying a web-host with cPanel already installed. Anyway, look into [URL="http://www.zpanelcp.com/"]zPanel[/URL], it's pretty much the same thing, but it's free. Could be useful for part of the tutorial bit.

Share this post


Link to post
Share on other sites
I have updated the guild a tad more, I included the whole "port not open" thing lol

[COLOR="silver"]- - - Updated - - -[/COLOR]

I have updated the guild a tad more, I included the whole "port not open" thing lol

Share this post


Link to post
Share on other sites
[quote name='Daedalus']Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol

[COLOR=silver]- - - Updated - - -[/COLOR]

Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol[/QUOTE]

Just a brief explanation of how it looks inside and how it works.

[COLOR="silver"]- - - Updated - - -[/COLOR]

[quote name='Daedalus']Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol

[COLOR=silver]- - - Updated - - -[/COLOR]

Good thing I have a web host currently using WHM/cPanel xD

And do you mean setting up cPanel, or telling the ins and outs to it? lol[/QUOTE]

Just a brief explanation of how it looks inside and how it works.

Share this post


Link to post
Share on other sites
[quote name='Ranger']Just a brief explanation of how it looks inside and how it works.

[COLOR=silver]- - - Updated - - -[/COLOR]



Just a brief explanation of how it looks inside and how it works.[/QUOTE]


Ah, was going to say that I don't even own my own cPanel license to actually install it on a virtual machine xD but yeah I guess I can with this host I am using, which I also have WHM on :L

[COLOR="silver"]- - - Updated - - -[/COLOR]

[quote name='Ranger']Just a brief explanation of how it looks inside and how it works.

[COLOR=silver]- - - Updated - - -[/COLOR]



Just a brief explanation of how it looks inside and how it works.[/QUOTE]


Ah, was going to say that I don't even own my own cPanel license to actually install it on a virtual machine xD but yeah I guess I can with this host I am using, which I also have WHM on :L

Share this post


Link to post
Share on other sites
Make a random [url]http://000webhost.com/[/url] website. They offer cpanel for the site you create for free.

[COLOR="silver"]- - - Updated - - -[/COLOR]

Make a random http://000webhost.com/ website. They offer cpanel for the site you create for free.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×