Click to See Complete Forum and Search --> : can we have more than one website on the same OS ?
manishrathi
06-07-2009, 03:23 PM
If more that one website is on the same os, then how is the port number managed ? www.sample1.com and www.sample2.com are on the same OS. Now by default one website will be on port 80 and other on some other port number. We have to type in port number to access the website which is not on port 80, right ? But when we access these website, we never type in portr numbers, which means all websites are on port 80. So how is this possible ?
Pls explain how to maintain more than one app on same os.
thanks
Four Staples
06-07-2009, 03:27 PM
You only need to have a different port number for each server instance you are running. Most servers run more than one website (it's called shared hosting) and they store each website in a different directory.
EDIT: For example, my website can be found at http://michael.asmallorange.com/~dtomasie. Other users on the server would have their site at http://michael.asmallorange.com/~anotheruser. However, they have their domain servers setup to only redirect fourstaples.com to http://michael.asmallorange.com/~dtomasie.
manishrathi
06-07-2009, 05:09 PM
So for every website, there is a separate server instance. Is that you mean to say ? Every server instance is on separate port number. So the website on server instance will be located by default. ie if www.sample1.com is on server instance which in turn is on port 80 then this server instance will be located for a request coming with www.sample1.com. If sample2.com is on server instance which is on other port than 80 and if http request comes in as www.sample2.com, how will it be located ? How the other server instance which is not on port 80 will be found, if httpRequest does not come in with port number hosting that server instance ?
Four Staples
06-07-2009, 06:20 PM
Well, let me define a few terms..
Server instance - an installation of a server. you can have apache installed multiple times on a single OS, they just need to use a different port number.
Theoretically, you can have unlimited websites on each instance.. the reason you'd want to have more than one instance is if you want each website to have their own httpd.conf or php.ini settings that aren't able to be manipulated with .htaccess or ini_set().
Also, you could easily limit CPU and memory usage for each instance if you don't want someone hogging all the resources (although I'm pretty sure you can configure a server to limit memory/cpu usage by user or directory anyway).
Now to your example... port 80 isn't actually special in any way, it's just a number. It also happens to be the __default__ port for most web servers. You could run Apache from port 92057 or port 2 and it'd be completely stable.
www.sample1.com would simply point to <your server's IP>:80
and
www.sample2.com would point to <your server's IP>:some other port
EDIT: I think I should mention also that web browsers will connect to port 80 by default, but it's port 80 on the domain it's connecting too. So to expand the above example:
www.sample1.com:80 points to <server IP>:80
and
www.sample2.com:80 points to <server IP>:some other port
manishrathi
06-07-2009, 08:34 PM
Thats what I am asking. We dont need to mention port 80 (as its default), while sending http request from the browser. But if its different port number then we have to mention that port number. So if www.sample2.com is on port 25002, then to send a request to for www.sample2.com, do I need to mention port number ? If no, then how to make sure that without mentioning port number the request comes to the specified port ?
We are not specifying port number while sending http request. So if the website is on different number than default (ie 80), then how does the request get to the exact port number ? How is the request mapped to exact port number ?
Four Staples
06-07-2009, 08:58 PM
No, you tell your DNS to point sample2.com to <ip address>:25002 and the user never needs to know anything about the private port.