• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

serve on two port with same apache

ok..so I have vhost.server.com.  I want to run vhost.server.com:8080 that points to another directory.  Is this possible? Can someone please explain this to me?

 
0
JohnnyDog
Asked:
JohnnyDog
  • 3
1 Solution
 
samriCommented:
Hi JohnnyDog,

You would be looking at implementing VirtualHosting with Apache.

First of all you would need to have DNS configured so that

vhost.server.com (and all other vhosts resolves to the IP address of the server).  This can be using CNAME in DNS.

For example;

www.server.com.    IN A 1.2.3.4
vhost1.server.com. IN CNAME www.server.com.
vhost2.server.com. IN CNAME www.server.com.
vhost3.server.com. IN CNAME www.server.com.

Next;

In httpd.conf, you need to bind apache to port 8080 (by default apache will listen on port 80).
Listen 80
Listen 8080

more info: http://httpd.apache.org/docs/mod/core.html#listen

Next if the Vhost section needs to be configure.
Follwing is the simple config.  Please note that most apache configuration directive could go into Vhost container.

--
NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4:8080>
   DocumentRoot "/vhost1/htdocs"
   ServerName vhost1.server.com
</VirtualHost>

<VirtualHost 1.2.3.4:8080>
   DocumentRoot "/vhost2/htdocs"
   ServerName vhost2.server.com
</VirtualHost>
---
Please take a look at apache documentation on Vhost:
http://httpd.apache.org/docs/vhosts/index.html

good luck.
0
 
samriCommented:
JohnnyDog,

Any good news?
0
 
JohnnyDogAuthor Commented:
yes I got it working...thanks samri!
0
 
samriCommented:
Johhny, great day to you!.

Glad to be able to help.

So you can accept my comment, and award a grade (as you feels right).

cheers.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now