Jump to content

How do I prevent using http://localhost/test and only using virtualHost ServerNa


bongobongo

Recommended Posts

Let say I have a subdir in webserver root called:

 

test

 

And I then create a virtualHost with :

...

...

DocumentRoot c:/www/htdocs/test

ServerName local.test.com

..

...

 

Now, is it possible to prevent anything being served using this

address:

http://localhost/test

 

I only want the site beeing accessible using:

local.test.com

 

How do I do that?

You're thinking of the virtualhost tags.

 

On linux, this would be defined in: /etc/apache2 (or /usr/local/apache2) /conf/extra/virtualdomains

 

I assume on windows it would be something like c:\apache\conf\extra\virtualdomains.

 

These virtualhost tags help define subdomains/locations. Good luck.

 

 

Those are the *most common* (at least I thought so!!!)

 

Nah.. for instance, on Gentoo (my fav OS) virual hosts are placed within /etc/apache2/vhosts.d

 

While other systems Ive used use the upstream default apache config where your vhosts are actually specified within the global httpd.conf file.

 

Lots of distro's have lots of ways of going about different configs.

Fascinating!

 

I figured once the default structure of the apache package was installed, it installed as any other app. I do understand that the httpd.conf can link to many other files, but I thought it distributed equally on all platforms.

 

Gentoo is a great OS btw ;)

Debian and Ubuntu store apache under the following paths:

 

Only configs are placed inside:

/etc/apache2/

 

Configs for vhosts are stored in:

/etc/apache2/sites-available/virtualsite1.com

a2ensite

symlinks the above into: /etc/apache2/sites-enabled/virtualsite1.com

 

The webroot is by default in /var/www/

 

If you want multiple websites etc. I recommend making a /srv/www/ folder to hold the webroot for subdomains. e.g.

/srv/www/host1

/srv/www/host2

etc.

 

This seperates out the config files from the content files.

 

Debian setup & config of apache: http://wiki.kartbuilding.net/index.php/Apache_2_%26_SSL_-_PHP4_-_MySQL_4.1

 

-steve

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.