Test multiple sites on local machine

I’ll be designing and creating multiple websites and would like to test them on my local PC prior to uploading on the actual server. The official sites are not open to public yet, but in the future once it is up and running, I wan to make and test the changes locally.

I’ve tried searching for a tutorial on how I can do this, but none has really given me a step by step tutorial.

does anyone know how I can go about this?

thanks :slight_smile:

Is this an IIS (Windows based) machine or are you hosting on Linux on Apache web server or some such?

If it’s a windows site it’s quite simple - the setup is pretty similar regardless of technology

I can’t really walk you through the Linux process, but the Windows one is as follows:

  • Browse to Control Panel -> Administrative Tools -> Internet Information Services

If you haven’t got IIS installed go install it now - you should find it somewhere in ‘Windows Components’ in Add/Remove Programs

  • Make sure you have a Default Website (under the Web Sites folder) or at least one website set up. Check the properties and go to the Home Directory tab - look for Local Path, it usually points to “c:\Inetpub\wwwroot”. This is your web folder in which your sites will reside.

  • Each new folder within the wwwroot folder can be it’s own seperate ‘website’ although they are all running through the same ‘Website’ in IIS. Confusing terms maybe! I could explain further but if you just take my word for it :slight_smile:

  • So for each new web project make a new folder in wwwroot. You can browse to your web projects by going to ‘http://localhost/name_of_project/’ - if you right click the folder in IIS and go to Properties -> Documents tab -> check the Enable Default Document box you can set the default page (in case it’s not index.htm).

  • Last of all you can actually have folders elsewhere on your HD which can run under this ‘Default Website’ - if you right click the Default Website node you can create a new ‘Virtual Directory’. Give the Virtual Dir an ‘alias’ and browse to a completely different folder on your PC and you can point to the contents of that directory instead of putting it all in wwwroot. You can then access it via ‘http://localhost/name_of_virtual_dir_alias

(note: replace localhost with your IP address if you have bound the website to an adapter)

That should get you started

You can also do it by setting up a seperate IIS website for each project, but I just prefer to lump them under one area unless there’s a very specific reason not to.

XAMPP FTW. It will install apache, mySQL, PHP, and some other stuff so that you can run a localhost apache server on your computer.

[quote=Charleh;2341341]Is this an IIS (Windows based) machine or are you hosting on Linux on Apache web server or some such?

If it’s a windows site it’s quite simple - the setup is pretty similar regardless of technology

I can’t really walk you through the Linux process, but the Windows one is as follows:

  • Browse to Control Panel -> Administrative Tools -> Internet Information Services

If you haven’t got IIS installed go install it now - you should find it somewhere in ‘Windows Components’ in Add/Remove Programs

  • Make sure you have a Default Website (under the Web Sites folder) or at least one website set up. Check the properties and go to the Home Directory tab - look for Local Path, it usually points to “c:\Inetpub\wwwroot”. This is your web folder in which your sites will reside.

  • Each new folder within the wwwroot folder can be it’s own seperate ‘website’ although they are all running through the same ‘Website’ in IIS. Confusing terms maybe! I could explain further but if you just take my word for it :slight_smile:

  • So for each new web project make a new folder in wwwroot. You can browse to your web projects by going to ‘http://localhost/name_of_project/’ - if you right click the folder in IIS and go to Properties -> Documents tab -> check the Enable Default Document box you can set the default page (in case it’s not index.htm).

  • Last of all you can actually have folders elsewhere on your HD which can run under this ‘Default Website’ - if you right click the Default Website node you can create a new ‘Virtual Directory’. Give the Virtual Dir an ‘alias’ and browse to a completely different folder on your PC and you can point to the contents of that directory instead of putting it all in wwwroot. You can then access it via ‘http://localhost/name_of_virtual_dir_alias

(note: replace localhost with your IP address if you have bound the website to an adapter)

That should get you started

You can also do it by setting up a seperate IIS website for each project, but I just prefer to lump them under one area unless there’s a very specific reason not to.[/quote]

thanks so much… I will try that on monday when I get back to work and let you know how it goes.

[quote=Charleh;2341341]Is this an IIS (Windows based) machine or are you hosting on Linux on Apache web server or some such?

If it’s a windows site it’s quite simple - the setup is pretty similar regardless of technology

I can’t really walk you through the Linux process, but the Windows one is as follows:

  • Browse to Control Panel -> Administrative Tools -> Internet Information Services

If you haven’t got IIS installed go install it now - you should find it somewhere in ‘Windows Components’ in Add/Remove Programs

  • Make sure you have a Default Website (under the Web Sites folder) or at least one website set up. Check the properties and go to the Home Directory tab - look for Local Path, it usually points to “c:\Inetpub\wwwroot”. This is your web folder in which your sites will reside.

  • Each new folder within the wwwroot folder can be it’s own seperate ‘website’ although they are all running through the same ‘Website’ in IIS. Confusing terms maybe! I could explain further but if you just take my word for it :slight_smile:

  • So for each new web project make a new folder in wwwroot. You can browse to your web projects by going to ‘http://localhost/name_of_project/’ - if you right click the folder in IIS and go to Properties -> Documents tab -> check the Enable Default Document box you can set the default page (in case it’s not index.htm).

  • Last of all you can actually have folders elsewhere on your HD which can run under this ‘Default Website’ - if you right click the Default Website node you can create a new ‘Virtual Directory’. Give the Virtual Dir an ‘alias’ and browse to a completely different folder on your PC and you can point to the contents of that directory instead of putting it all in wwwroot. You can then access it via ‘http://localhost/name_of_virtual_dir_alias

(note: replace localhost with your IP address if you have bound the website to an adapter)

That should get you started

You can also do it by setting up a seperate IIS website for each project, but I just prefer to lump them under one area unless there’s a very specific reason not to.[/quote]

wont’ this mean though, it won’t utilize the root folder, when uploaded on the actual site server?

if I have an image it’ll be src="/images/name.jpg"
but if i set up this way, it won’t work, because it’ll have to be src="/sitefolder/images/name.jpg"

am i right?

Do a google search for “hosts file”

If your production server is a linux machine, you should really consider doing your development on a linux box as well.

As for transferring your websites from your pc to the productions server, I’d consider using a version of rsync for windows. rsync is a Unix/Linux program that copies directories of files from one location to another, including a remote host. It is efficient because it only moves files that are different in the two directories. So, if you change one file, you can just rsync the entire website directories and the program will only move the one file that you changed.

With this tool, you could rsync the ‘root’ folder from one machine to another, regardless of where they are located or named.

[quote=acc;2344244]wont’ this mean though, it won’t utilize the root folder, when uploaded on the actual site server?

if I have an image it’ll be src="/images/name.jpg"
but if i set up this way, it won’t work, because it’ll have to be src="/sitefolder/images/name.jpg"

am i right?[/quote]

Using those paths for images has nothing to do with the root folder - you are using relative paths - an image tag with a src of “/images/name.jpg” will always point to a subfolder relative to the path of the requesting document

Take this layout for example

wwwroot

  • Site1
    File1
    Folder1
    Image1
  • Site2
    Some other files/folders

Assuming the two folders Site1 and Site2 are completely different websites and you are treating their respective folders as the site root there should be no difference from a regular website. File1 under Site1 can reference Image1 (under Folder1) using the path “/Folder1/Image1”. You can, if you want, navigate out of the root directory and reference the other site - this is where links will start getting iffy if you were to upload to a live server assuming the Site1 folder was the root.

Example:

Imagine an image tag pointing to an image contained in Site2 from within File1 - it would look like “…/Site2/Some Folder/Some File”. Of course uploading just the contents of Site1 to the live server will mean that this reference will become invalid.

You could however use an absolute path which may look like “www.site2.com/Some Folder/Some File” but this may mean that your images won’t display in your HTML editor (assuming you are using one) as the path will not be valid until the site is live.

Uploading the site to the server has nothing to do with the folder that the site is in on the local machine - only the actual structure of the files and subfolders within your project folder matters as you will be uploading as if your project folder is the site root.

In simple terms … Don’t upload the site folder, just upload the *contents *of the site folder