Create Second IIS 7 Website on local computer

Various changes to the Windows Operating System, also for the Intranet

Moderator: sjj1805

Post Reply
User avatar
sjj1805
Posts: 1113
Joined: Fri Oct 27, 2006 12:45 am
operating_system: Windows 8 Pro
motherboard: Equium P200-178
system_drive: C
32bit or 64bit: 32 Bit
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
video card: Intel 945 Express
sound card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Create Second IIS 7 Website on local computer

Post by sjj1805 » Sat Sep 23, 2017 2:35 am

Firstly you create the first website in the usual way and get it all up and running with PHP, MySQL / MySQLi etc and your various databases such as PHPBB3 (Forum) Coppermine (Photo Gallery) Serendipity - S9Y (Blog).
Once you have a working website - you may find a need to create a second website on the same computer. One such reason is that some programs or add ins do not work with PHP7.x (The latest version) but work perfectly with an earlier version such as PHP5.x.

I will assume you have PHP5.x installed.
First step is to install a copy of PHP7.x and for this you can simply use the Web Platform Installer from Microsoft.
once installed check that your website is now using PHP7.x
Having satisfied yourself that this is the case we can now proceed to create a second website - but the second website will be configured to use your other version of PHP5.x. We also need to make sure that MySQL / MySQLi works on the second website.
Edit the following file on your computer:

Code: Select all

C:\Windows\System32\Tasks\MySQL\Installer\ManifestUpdate
Find the line
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
and change it to
<MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
This is to allow MySQL to run on both websites.
Next Step:
Open IIS Manager on your computer.
in the section IIS look for "Handler Mappings"
In the name column you will find an entry "PHP_via_FastCGI" and another one "PHP_via_FastCGI1" - if you have previously updated your version of PHP perhaps from PHP5.4 to PHP6.1 then you may find more similar entries such as "PHP_via_FastCG2" "PHP_via_FastCG3" and so on. Double click an entry and
look at the entry Executable (optional) - this will identify which version of PHP that entry refers to. Make a note of the name of the original PHP you were using before installing PHP7. Make another note of the name of the new PHP7 entry.
On the right hand column of the Handler Mappings screen you will see a line that reads "View ordered list..."
What you now do is click that line and now the list of handler mapping entries is no longer in alphabetical order but is in order of importance, The entry at the top of the list takes precedence of those below. You will also see in the Actions column options to move an entry up/down.
Using these options move the "PHP_via_FastCGI" entry relating to your original PHP5.x to the top of the list.
If you now check your website again you will find that it is again using PHP5.x

We will now create a second website.
in Windows Explorer go to the root of your website which is normally C:\inetpub\wwwroot
Now create a new folder C:\inetpub\www2
This is where your second website will reside. You may want to copy a few things over from your existing website such as
PHPinfo.php
the directory phpMyAdmin
iisstart.htm
While these files are not necessary you will find it useful to have something in the website if only to make sure it is working!

Next step is to go back into IIS Manager and in the left hand column click "Sites"
At this point there should only be the one site shown - your existing site.
On the right had side of IIS Manager under the "Actions" column you will see "Add Website"
Click this and a pop up appears for you to fill in.
Give the site a name such as web2.
Under content directory "Physical Path" navigate to your new web site C:\inetpub\www2
Under "Binding" alter the port number from 80 to 81, click the OK button and your site is now ready.
Goto your web browser and enter the address http://localhost:81/ - you should now see the welcome screen. (You can change localhost to whatever name you have called your computer). Now check that PHP is working on your new site
http://localhost:81/phpinfo.php

At this point both your original site
http://localhost/
and new site
http://localhost:81
Are using the same version of PHP 5.x

Once again go to IIS manager.
Select your original website and go to the Handler Mappings screen. Using the move options move the "PHP_via_FastCGI" entry relating to your new PHP7.x to the top of the list.
A pop up will appear which you have to confirm before you are able to move the entry.

You ONLY move this entry on the one website not both!
Now check that PHP7.x is working on your original site
http://localhost/phpinfo.php

and that PHP5.x is working on your new site
http://localhost:81/phpinfo.php

One last thing - if you are using your web server as a publicly viewable site then don't forget to allow an exception in Windows Firewall for Port 81 otherwise no one will be able to see it outside of your LAN.
Don't forget to add port forwarding in respect of port 81 in your network router.
That's it - you're all done!

User avatar
sjj1805
Posts: 1113
Joined: Fri Oct 27, 2006 12:45 am
operating_system: Windows 8 Pro
motherboard: Equium P200-178
system_drive: C
32bit or 64bit: 32 Bit
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
video card: Intel 945 Express
sound card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Add FTP

Post by sjj1805 » Sun Sep 24, 2017 8:57 am

Now we have our second website up and running we need to add a few more things.
The first is FTP so that you can prepare things on a remote computer and then upload them to the website.
I prepare all of my web pages and content on a computer which I have named "Earth" - my Public facing computer is named "Sun."
After developing changes to my website on "Earth" I use Filezilla to synchronise the two computers. For this you need to have FTP publishing installed.

Open IIS Manager.
Select your new website.
In the right hand column you will see an option to add FTP publishing.
The only difference you need to make here when selecting this option is to change the "Port number." FTP defaults to Port 21. However your original website is using Port 21.
All you need do is to specify a different port number. I have found that Port 5000 is suitable.

User avatar
sjj1805
Posts: 1113
Joined: Fri Oct 27, 2006 12:45 am
operating_system: Windows 8 Pro
motherboard: Equium P200-178
system_drive: C
32bit or 64bit: 32 Bit
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
video card: Intel 945 Express
sound card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Replicate Important folders

Post by sjj1805 » Sun Sep 24, 2017 9:13 am

You may find that in your second web site you need exact copies of directories contained in your main website.
For example.
The top of my website has various buttons. These are all located in a folder:
C:\inetpub\wwwroot\Graphics
In addition to the intended use of coppermine to store Photo Albums I also use Coppermine as the basis for storing many of my items such as "Books" "Documents" "Restaurants" "Links" "Shopping" and "Newspapers".
Coppermine has what is termed a bridging option. This shares the log in/out function contained in my PHPBB3 Forum software. You log into on of these databases and you are logged into all of them.
So in addition to requiring an exact copy of "Graphics" I also need an exact copy of my "Forum" Folder
C:\inetpub\wwwroot\Forum

You do not need to copy these folders, all you need to do is fool your computer into believing that they exist twice by using "Junctions"
Click here for an explanation of junctions.

To replicate the above two junctions you open a command prompt (cmd) as an Administrator and paste the following

Code: Select all

mklink /d “C:\inetpub\www2\Forum” “C:\inetpub\wwwroot\Forum”
mklink /d “C:\inetpub\www2\Graphics” “C:\inetpub\wwwroot\Graphics”
One last thing is website security.
If you have restricted access to a particular folder or file on your main website and you have copied that file or folder to your second website by whatever means, you will have to set the restrictions again on the second website.

Post Reply