This is a discussion on Virtual Hosting and ports within the Apache Web Server forums, part of the Web Server and Related Forums category; Can anyone tell me if your Apache web server is listening only on port 80, is it possible using Virtual ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Can anyone tell me if your Apache web server is listening only on port 80,
is it possible using Virtual Hosting to pass the request on to both a different URL and Port ? Kind of like port forwarding. Cant get it to work. How do you do it? Thanks in advance. |
|
|||
|
speedsite <reidk@speedsite.dot.com> wrote:
> is it possible using Virtual Hosting to pass the request on to both a > different URL and Port ? Yes, it is. Use the mod_proxy. ProxyPass /somedir/ http://someip:someport/somedir/ ProxyPassReverse /somedir/ http://someip:someport/somedir/ Davide |
|
|||
|
David,
I'm trying to do the same thing. I'm trying to change my webserver port from 80 to 8008. Here's my config file, although its been cut up because of lenght. It still has all the pertinent info. I have a router with the webserver behind it with a private ip. Mine still didn't work.????? Listen *:8008 ServerName 192.168.0.101 <IfModule mod_proxy.c> ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /var/www/html http://192.168.0.101:8008 ProxyPassReverse /var/www/html http://192.168.0.101:8008 # # Enable/disable the handling of HTTP/1.1 "Via:" headers. # ("Full" adds the server version; "Block" removes all outgoing Via: headers) # Set to one of: Off | On | Full | Block # #ProxyVia On # # To enable the cache as well, edit and uncomment the following lines: # (no cacheing without CacheRoot) # #CacheRoot "/etc/httpd/proxy" #CacheSize 5 #CacheGcInterval 4 #CacheMaxExpire 24 #CacheLastModifiedFactor 0.1 #CacheDefaultExpire 1 #NoCache a-domain.com another-domain.edu joes.garage-sale.com </IfModule> |
|
|||
|
josh lynch <iconoclast88@verizon.net> wrote:
> Listen *:8008 ?? why this? > <IfModule mod_proxy.c> > ProxyRequests Off ? "Off" ? > ProxyPass /var/www/html http://192.168.0.101:8008 > ProxyPassReverse /var/www/html http://192.168.0.101:8008 This maps an url like http://yourserverhere/var/www/html to te other server. Are you sure this is what you want to do? Davide |
|
|||
|
"Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message news:bmhafq$mt7n1$2@ID-18487.news.uni-berlin.de... > josh lynch <iconoclast88@verizon.net> wrote: > > Listen *:8008 > > ?? why this? I was doing 8008, because it is unused. I was thinking why not? Is it not wise? > > <IfModule mod_proxy.c> > > ProxyRequests Off > > ? "Off" ? > I'm new to apache. I tried it with it "on" as well. I tried reading up on this syntax on Apache's Doc site, and it wasn't very in-depth. > > ProxyPass /var/www/html http://192.168.0.101:8008 > > ProxyPassReverse /var/www/html http://192.168.0.101:8008 > > This maps an url like http://yourserverhere/var/www/html to te > other server. Are you sure this is what you want to do? > > Davide Well, I don't have a Domain name. Only an IP. I didn't know what you meant in your earlier post by "ProxyPass /somedir/ http://someip:someport/somedir/ ProxyPassReverse /somedir/ http://someip:someport/somedir/" I can't get apache to work for me, although IIS for microsoft does work using a different port than "80". I'm just trying to get access to my server from outisde my lan, and It seemed as though using this mod_proxy could take care of the issue. So what do you mean by "ProxyPass /somedir/"??? Should the variable for both Pass and PassReverse be the same? For some reason, just changing the listen port won't let me access the server from outside the lan, nor from a nother pc in the lan. I can only access it using http://localhost:8008 I am out of ideas. Josh |
|
|||
|
josh lynch <iconoclast88@verizon.net> wrote:
> I was doing 8008, because it is unused. I was thinking why not? Is it not > wise? Well, normally web server listen on port 80, sometimes 8080 if you can't run them on port < 1024, but there is no reason, really. > "ProxyPass /somedir/ http://someip:someport/somedir/ > ProxyPassReverse /somedir/ http://someip:someport/somedir/" Ok, let's go with the explanation: When you type an URL in your browser your browser send a request to a server using the domain name (or the IP if you use the ip), then ask for a page/directory. The page/directory is relative to the so-called "document root", that can be a physical directory in the machine or can be just a name (alias). The /somedir/ entry is just a placeholder, is not required that you have a _real_ directory with that name, is only used to make apache understand that you want to access something, so Apache can work his magic. Actually, if you want to use the Proxy method, is way better if you don't have a real directory with the same name. > Should the variable for both Pass and PassReverse be the same? Yes, they have to be the same, so Apache knows that he have to substitute all the links with the "directory" you specified. Let's suppose you used ProxyPass /myserver/ http://theipoftheserver:8008/htdocs/ ProxyPassReverse etc.etc. When you contact apache using http://.../myserver/... He will understand that you want the /myserver/ directory, but there is no such directory, so, he will use the Proxy instead to contact the other machine and pass to you the results, changing the /htdocs/ bit with /myserver/ in the resulting pages. Is this a little more clear? > For some reason, just changing the listen port won't let me access the > server from outside the lan, Do you have a firewall? Maybe your firewall is blocking the access. Davide |
|
|||
|
Ok, maybe to make the problem i'm having (which others may eb having as
well) a bit clearer: My dsl provider blocks port 80 so I can't have any incoming connections.(residential service as opposed to business)) So, I have to use a different port so that I can use my web server. I've been frustrated with getting apache to work because no one seems to know how to do this, when windows IIS using the same configuration and IP behind the same NAT firewall/router can be accessed. Windows is getting the best of linux. I'm not giving up because I know it can be done (I hope). I don't want to have to use windows web server. Also, if this mod_proxy config will work, if there isn't a specific "/myserver/" directory I want to reroute, just the main root folder itself, what would I use? I appreciate your help, David. Josh - - -Davide Bianchi wrote: > josh lynch <iconoclast88@verizon.net> wrote: > >>I was doing 8008, because it is unused. I was thinking why not? Is it not >>wise? > > > Well, normally web server listen on port 80, sometimes 8080 if you > can't run them on port < 1024, but there is no reason, really. > > >>"ProxyPass /somedir/ http://someip:someport/somedir/ >>ProxyPassReverse /somedir/ http://someip:someport/somedir/" > > > > Ok, let's go with the explanation: > When you type an URL in your browser your browser send a request to > a server using the domain name (or the IP if you use the ip), then ask > for a page/directory. The page/directory is relative to the so-called > "document root", that can be a physical directory in the machine or > can be just a name (alias). The /somedir/ entry is just a placeholder, > is not required that you have a _real_ directory with that name, is > only used to make apache understand that you want to access something, > so Apache can work his magic. Actually, if you want to use the > Proxy method, is way better if you don't have a real directory with > the same name. > > >>Should the variable for both Pass and PassReverse be the same? > > > Yes, they have to be the same, so Apache knows that he have to substitute > all the links with the "directory" you specified. > > Let's suppose you used > > ProxyPass /myserver/ http://theipoftheserver:8008/htdocs/ > ProxyPassReverse etc.etc. > > When you contact apache using http://.../myserver/... > > He will understand that you want the /myserver/ directory, but there is > no such directory, so, he will use the Proxy instead to contact the > other machine and pass to you the results, changing the /htdocs/ bit with > /myserver/ in the resulting pages. > > Is this a little more clear? > > >>For some reason, just changing the listen port won't let me access the >>server from outside the lan, > > > Do you have a firewall? Maybe your firewall is blocking the access. > > Davide |
|
|||
|
josh lynch <iconoclast88@yahoo.com> wrote:
> My dsl provider blocks port 80 so I can't have any Aw, that sucks... > frustrated with getting apache to work because no one seems to know how > to do this Change the Port directive, that's the only thing you need to touch in the Apache configuration to have him listening to something different than port 80. > "/myserver/" directory I want to reroute, just the main root folder > itself, what would I use? Just use "/" instead of "/myserver/". I use different "directories" because I have multiple machines all accessible trought one single proxy, and I need multiple "directories" to differentiate machine or application. Davide |
|
|||
|
Ahh, I see.
I got it working. All this time. I rebooted my router, and all is well. Geeze. David, I appreciate your effort to solve an unsolvable equation. Josh "Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message news:bmk5q4$nho7k$2@ID-18487.news.uni-berlin.de... > josh lynch <iconoclast88@yahoo.com> wrote: > > My dsl provider blocks port 80 so I can't have any > > Aw, that sucks... > > > frustrated with getting apache to work because no one seems to know how > > to do this > > Change the Port directive, that's the only thing you need to > touch in the Apache configuration to have him listening to > something different than port 80. > > > "/myserver/" directory I want to reroute, just the main root folder > > itself, what would I use? > > Just use "/" instead of "/myserver/". I use different "directories" > because I have multiple machines all accessible trought one single > proxy, and I need multiple "directories" to differentiate machine > or application. > > Davide |