How do I configure my apache for this?

Hi,

I need some help on how to do this configuration on my apache.

  • All instance are running on a single IP address on my Linode.

  • http://mydomain1:80 point to Docroot1

  • http://mydomain1:8080 point to Docroot2

Now, I wasn to get a new domain, say mydomain2 so that http://mydomain2:80 will be just alias for http://mydomain1:8080

Is this possible? If so, how would my httpd.conf entries looks like? Since I want to give an option for my user to just use the mydomain2 to bring up whatever Docroot2 that was originally running on port 8080 of mydomain1

Thanks.

8 Replies

Do you have to run the other on another port?

Yes, that's how ports are allocated to different developers with the team.

Is this do-able? Thanks.

Try this:````
NameVirtualHost aaa.bbb.ccc.ddd:80
NameVirtualHost aaa.bbb.ccc.ddd:8080

where aaa.bbb.ccc.ddd is the IP address of your server

ServerName mydomain1.com DocumentRoot /path/to/docroot1

ServerName mydomain1.com DocumentRoot /path/to/docroot2

ServerName mydomain2.com DocumentRoot /path/to/docroot2
````

You will need ServerAlias entries in each VirtualHost block for any other host names that they should respond to. Unaliased host names will use the first (default) VirtualHost entry.

Thanks for the information. I will see how it goes.

Forgot to mentsion one thing…. I am trying to do this a my work location as well.

The setting are:

Host1 (with different ports assign to different developers) is a BigIP which distribute the traffic to different web instance. For example host1:port1 could route to hostA:1, host1:port2 will route to hostB:port 2 So user will access their ports using host1:port_number and it will route all traffic to different A/B/C host with the same port number.

Will this conf work on this case as well? Given that the conf that I have are on hostA/B/C, not on Host1.

Thanks.

The VirtualHost directives map hostnames (as specified in the HTTP headers) and (optionally) port numbers to document roots. As long as the forwarding server leaves the HTTP headers intact, you can put VirtualHost directives on the A/B/C servers to direct the incoming requests to the correct document root based on requested server name and (optionally) the port that the request was delivered to. If the forwarding server rewrites the HTTP headers, then this scheme will not work.

When using a BigIP there should be no need to configure Apache Virtuals, You can set the big ip to accept the connections and filter/direct the traffic to the desired server/port. It has been some time since I have worked with a big IP so can't remember exactly how to do this, but know I have used it many times.

Chris

Thanks for help, Peter.

For the NameVirtualHost, should I use the IP address of Host1 (the forwarding host) or the IP of A/B/C host itself?

Thanks.

@komy:

For the NameVirtualHost, should I use the IP address of Host1 (the forwarding host) or the IP of A/B/C host itself?
Specify the IP address of the physical interface on the machine which will be servicing the requests (i.e. your A/B/C host).

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct