Friday, February 29, 2008

Using Apache and IIS for hosting in the same machine

Today both the IIS and Apahe are 2 leading servers in the world. but unfortunately Apache is not supporting for asp where IIS support for both asp and PHP (not by default but we can configure with PHP instaltions). But still there are some issues where I faced when i try to use MySQL with PHP in IIS. There for its better to use IIS for ASP and Apache for PHP.

In this case we should install both IIS and Apache in the same PC(If we have more than one computer then there wont be any issue.we can install IIS in one machine and Apache in other machine.) .
when we host a website in a server the server should run on port 80. Otherwise the user have to type the port number as well in order to access the website. But we know that we cant use one port for 2 applications. There for we can configure only one server to run on port 80. But in our case we have 2 servers run on the same machine (i.e. IIS and Apache). and both servers should be accessible from the outside without typing the port number.

By doing the followings we can achieve this task.
1. Install Apache in the server and configure it to use port 80.(by default its using port 80, so no need to configure it).
2. Configure it for php support.
* if you using XAMP or WAMP kind of a software then you do not need to configure for PHP. its all configured and we can use it without any changes.
3. Install IIS and add the website that you want to host in IIS.
4. Right click on the newly created website and go to properties
5. Change the port number to some other port number (Not 80).
6. Start the website by click on the Start Icon in the tool bar.

7. Open your browser and check weather the site can be accessed with the url and the port.
e.g 85 is the port number.
http://localhost:85

8. Open the httpd.conf. uncomment the following lines by removing '#'

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule rewrite_module modules/mod_rewrite.so

This will enable proxy support of Apache and we can use Apache for redirection and etc...

9. then go to # Virtual hosts in httpd.conf ( if you use XAMPP then it will be as follows
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
which means the virtual host configurations will be in a file call httpd-vhosts.conf in conf/extra. you have to open that file)

then add the following lines.

Namevirtualhost *:80


ServerName your url here
ProxyRequests off
ProxyPass / http://your ip here:new port/
ProxyPassReverse / http://your ip here:new port/


e.g

Namevirtualhost *:80


ServerName www.myserver.com
ProxyRequests off
ProxyPass / http://87.106.76.47:8080/
ProxyPassReverse / http://87.106.76.47:8080/


10. start the Apache. ( after any modification, you have to restart Apache.)

10. open your browser and type the URL without the port number. Thats it you can see your ASP page.

How it works.
all the incoming requests through port 80 will be handled by Apache. Then it will check the virtual host list and will handover to the relevant server to handle other transactions. all the connection will be handled by the Apache. IIS wont listen to Port 80.

Thursday, February 28, 2008

Unexpected Error 0x8ffe2740 in IIS 5.1

If you are using IIS 5.1 on XP and if you get an error when you try to start the default website saying that "Unexpected Error 0x8ffe2740 Occurred", which means you have a port conflict with some other software in your system. Most of the time this can be some other server software such as Apache. But in my case it was "Skype". skype is using port 80 and 443 as alternatives for incoming connections.

so if you want to use both IIS and Skype at the same time change the port settings of the skype or change the port settings of the iis. but the port 80 is the default port for any webserver such as IIS , Apache. there for its better to change the port settings of the Skype.

Saturday, February 9, 2008

About me

Name :Bhashitha Jayawardhane N.W.J.L
Address : No 23, 7th lane, Colombo road, padukka.
email : bashi003j@gmail.com ; bashi003j@yahoo.com