LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Webserver (https://www.linuxquestions.org/questions/linux-newbie-8/webserver-883647/)

saran_redhat 05-31-2011 12:25 AM

Webserver
 
Hi,

I have one webserver in my office. apache and lighthttpd running. two websites running on that server.

One websites running under apache another is running through lighthttpd. can anyone tel me second websites running though lighttpd with port number 81. if it is
possible to runnign this websites without port number.like this. www.example.com:81 to www.example.com. please help me.
Thanks

bathory 05-31-2011 12:54 AM

Hi,

Yes.
You can setup the example.com vhost in apache and configure it as a reverse proxy for the x.x.x.x:81 webserver (that is the IP of the lighttpd listening on port 81)

Regards

kindofabuzz 05-31-2011 12:55 AM

forward http to whatever port you want. I think that would be the solution.

saran_redhat 05-31-2011 06:59 AM

webserver
 
Quote:

Originally Posted by kindofabuzz (Post 4371607)
forward http to whatever port you want. I think that would be the solution.

Hi

Thanks for the reply.

In this case the both websites running
one website running through apache and the another one running through lighttpd without port number. so how i do this please help me.

I am using centos5.5
Thanks

wpeckham 05-31-2011 01:01 PM

two web servers on one machine
 
First, understand that two programs cannot share the same port on the same interface. You either need to virtualize/forward for one to a different port (see suggestions above) or have more than one IP address on this machine (with different DNS names for the IP addresses). There are several different ways you could go here.

Being a network engineer, I go with modifying the networking settings and configuring for the change. This is a bit complex on one end, but makes the web-server configurations very straightforward.
A very webby software kinda guy would probably rather configure the first web server to forward traffic to the other (on a different port - 81 perhaps) based upon the name used in the URL. This requires NO network change, requires duplication of the DNS address (minor), and slightly more complex web-server configuration.
A very 'Virtual' kinda guy might say move BOTH of these web-servers to virtual guests (using LXC or OpenVZ perhaps) and give each its own IP address and DNS name and stop worrying. (Because then the stock off-the-shelf configurations would work! Sounds like fun.)

Which solution appeals to you more, or sounds like something you would be more likely to enjoy?

saran_redhat 05-31-2011 11:51 PM

webserver
 
Quote:

Originally Posted by wpeckham (Post 4372177)
First, understand that two programs cannot share the same port on the same interface. You either need to virtualize/forward for one to a different port (see suggestions above) or have more than one IP address on this machine (with different DNS names for the IP addresses). There are several different ways you could go here.

Being a network engineer, I go with modifying the networking settings and configuring for the change. This is a bit complex on one end, but makes the web-server configurations very straightforward.
A very webby software kinda guy would probably rather configure the first web server to forward traffic to the other (on a different port - 81 perhaps) based upon the name used in the URL. This requires NO network change, requires duplication of the DNS address (minor), and slightly more complex web-server configuration.
A very 'Virtual' kinda guy might say move BOTH of these web-servers to virtual guests (using LXC or OpenVZ perhaps) and give each its own IP address and DNS name and stop worrying. (Because then the stock off-the-shelf configurations would work! Sounds like fun.)

Which solution appeals to you more, or sounds like something you would be more likely to enjoy?


Hi

Thanks for the reply.

I think my questions is not clear. sorry.

I have 2 websites running in the one webserver. first websites running through apache with port number 80. another websites running through lighttpd with port number 81. all its working fine . I want when i browse second website without port number(81). but now its working with port number (81). how I do this. please any help.
default apache runs without port number.
Thanks

guyfromcanada 06-01-2011 02:08 AM

I think I understand your question. You have two websites (abc.com and def.com, for example). You want to be able to access both websites without having to specify the port number, right?

In order to do this you need to run both websites on port 80. When you go to a website like google.com, the browser automatically appends the :80 to the end, because that's the default HTTP port. A user's browser trying to locate def.com won't know to use :81 because it's not a standard HTTP port. So with your current setup there is no way to achieve your goal.

The solution to this is called Name Based Virtual Hosts (vhosts) as wpeckam mentioned. Your best bet is to run both websites in Apache as virtual hosts instead of running two HTTP daemons. Apache will look for the user's request to see whether it should load abc.com or def.com. Detailed info can be found at Apache's website.

Hope this helps.

saran_redhat 06-01-2011 07:02 AM

webserver
 
Quote:

Originally Posted by guyfromcanada (Post 4372745)
I think I understand your question. You have two websites (abc.com and def.com, for example). You want to be able to access both websites without having to specify the port number, right?

In order to do this you need to run both websites on port 80. When you go to a website like google.com, the browser automatically appends the :80 to the end, because that's the default HTTP port. A user's browser trying to locate def.com won't know to use :81 because it's not a standard HTTP port. So with your current setup there is no way to achieve your goal.

The solution to this is called Name Based Virtual Hosts (vhosts) as wpeckam mentioned. Your best bet is to run both websites in Apache as virtual hosts instead of running two HTTP daemons. Apache will look for the user's request to see whether it should load abc.com or def.com. Detailed info can be found at Apache's website.

Hope this helps.

Hi,

You are correct. But I know that both website running through apache with port 80. but in this case I need separate website setup for one is through apache and another through lighttpd in one server. is it possible to run website through lighttpd without port number.
Please any solution.


Thanks

arizonagroovejet 06-01-2011 12:34 PM

Quote:

Originally Posted by saran_redhat (Post 4372984)
is it possible to run website through lighttpd without port number.

No.

bathory 06-01-2011 02:12 PM

Quote:

Originally Posted by saran_redhat (Post 4372984)
Hi,

You are correct. But I know that both website running through apache with port 80. but in this case I need separate website setup for one is through apache and another through lighttpd in one server. is it possible to run website through lighttpd without port number.
Please any solution.

Thanks

Take a look again at my post above. You need to setup a vhost at apache that does the reverse proxy for lighttpd.

Wim Sturkenboom 06-01-2011 02:20 PM

You can configure your NIC with 2 IP addresses. Let apache listen on the one and lighttpd on the other; both can now use port 80.


All times are GMT -5. The time now is 11:45 PM.