Link to home
Start Free TrialLog in
Avatar of ezlee
ezlee

asked on

apache config: web access based on port number

It 's easy to set up diffrent port number for virtual server with one IP address under win2000+IIS.
For example: we can access www.mydomain.com:1234 and www.mydomain.com:6789 

But how to do this under linux+apache?
I only found article describing virtual server based on different IP or domain name. But how to setup virtual server on diffrent port?

Avatar of jnbkze
jnbkze
Flag of Afghanistan image

Ezlee,

In your httpd.conf you add something like this to the end of the file and restart the apache server

<VirtualHost _default_:1080>
DocumentRoot /var/www/html/testvirt
ServerName Virttest
</VirtualHost>

The above says that it should listen for request on the default IP of your server on port 1080 and if it gets any requests, then it gets documents from /var/www/html/testvirt

The next example show if you specify an IP address

<VirtualHost 196.1.1.19:1999>
DocumentRoot /var/www/html/virtual1server
ServerName virtual1server
</VirtualHost>

This one says that it should only service requests that come in on IP 196.1.1.19 on the port 1999 and the document root for this server is /var/www/html/virtual1server

Let me know if you need any more help.
Note there are a lot of extra things you can put inbetween the <VirtualHost> </VirtualHost>

Regards,
jnbkze
ASKER CERTIFIED SOLUTION
Avatar of jnbkze
jnbkze
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ezlee
ezlee

ASKER

Jnbkze,

sorry for my delay, I was out for long time.
yes, it helped me. Thanks.

ezlee