Page 1 of 2
Voidmain's cool stuff

Posted:
Fri Mar 12, 2004 6:43 am
by Doogee
Hey voidmain how did you make it so if people go to your site via your IP (24.217.13.21 at time of writing , take it off if you want) they get a nice banner telling them to bugger off.
Cool idea, how can i do that?

Posted:
Fri Mar 12, 2004 10:15 am
by Void Main
That's really pretty easy. For instance, the default documentroot in the red hat setup is /var/www/html. I just put an index.html with whatever I want in there. In my case I just want a message that says "buzz off". Every site that I really want people to access I want them to access via a name like "voidmain.is-a-geek.net" and those go into a virtualhost configuration section each with their own documentroot. What this does is allows me to have more than just the voidmain site on this server and none of them are the default (show up when you go to the IP address) and thus if someone goes to one site they don't necessarily know that the other one is there, which might be for an entirely different purpose. You can see my configuration here:
http://voidmain.is-a-geek.net/files/configs/httpd.conf
I only removed a couple of vhosts from the above otherwise it's exactly what this sight is running on.

Posted:
Fri Mar 12, 2004 7:15 pm
by Doogee
I can't get it to work, i used (what seemed to be) your VHost configuration but it wouldn't work, apache just would not start. I dont quite grasp the virual host concept, i think ill read some docos

Posted:
Fri Mar 12, 2004 7:40 pm
by Void Main
If Apache will not start then you have an error in your config. It should tell you what the error is either on the screen when you try to start it or in the error_log file. You can also do a config test by running "apachectl configtest".

Posted:
Fri Mar 12, 2004 9:44 pm
by Doogee
i found the error but there was other complications (on the software side, not apache) that havebuggered me up for a while. ill do it later
I still dont get virtualhosts though

Posted:
Sat Mar 13, 2004 7:40 am
by Void Main
Virtual hosts are a way for you to have more than one web site on one machine. It gives the appearance of having multiple machines (virtual mahines, or virtual hosts). For example, say you have the DNS host names doogee.kicks-assk.net and homer.is-a-geek.net and they both point to your server's IP address. Using virtual host definitions in your apache configuration you can have a different web site for each name. Apache detects what name the user used in the URL in their browser to get to your server and if they used "homer.is-a-geek.net" then apache would use the settings for the homer.is-a-geek.net virtual host.
You can use almost any apache setting within the virtual host definition so you can tailor each web site individually. For instance, you would use a different DocumentRoot directory for each virtual host if you wanted a different web site for each name. You might want separate logs for each vhost. You might want different rewrite rules an other customizations. All of your apache settings you want applied to that virtual host go in that virtual host's definition in the apache config.
There are actually two types of virtual hosts in Apache. There are name based virtual hosts and IP based virtual hosts. You need to use the name based version (as I do on my home system). I would say name based is the most common. IP based virtual hosts require you to have more than one static IP address at your disposal. You would have 1 or more network interfaces in your server with more than 1 IP address assigned to the interface(s). Each virtual host would be bound to it's own IP address on the server for IP based virtual host configuration.

Posted:
Sat Mar 13, 2004 7:48 am
by Doogee
could i do it the other way around? So my actual document root is the default ser, but if they type an IP they get a virtual server?

Posted:
Sat Mar 13, 2004 8:17 am
by Void Main
No, I don't believe so. I have just got into the habit of using a vhost for every web site I set up on any Apache installation.

Posted:
Sat Mar 13, 2004 9:45 am
by Doogee
OK now ive got it set up, my blog and forums are server through a VirtualServer.
Problem is when i use the IP address i still get the virtualhost.

Posted:
Sat Mar 13, 2004 9:48 am
by Void Main
Can I see your config? You can upload it via ftp to my site (put it in /uploads).

Posted:
Sat Mar 13, 2004 9:51 am
by Doogee

Posted:
Sat Mar 13, 2004 10:11 am
by Void Main
I just realized that the config I pointed you to of mine was an older one. Here is the one that is more like my current setup:
http://voidmain.is-a-geek.net/files/configs/httpd.conf2
But it looks like what you have should work. If I try to go to
http://doogee.kicks-ass.net/ or directly to your IP address right now I get a "Forbidden" message. Probably because you don't have a '<Directory "/var/www/doogee"> ... ... ... </Directory>' statement (search your config for the '<Directory "/var/www/html"> ... ... ... </Directory>' section to use as an example. Might also want to look at my current config file. Notice I use an actual name instead of an '*' for my "NameVirtualHost" statement as well as in the VirtualHost definition. This name is in my /etc/hosts file and is associated with the IP address of my ethernet card.

Posted:
Sat Mar 13, 2004 10:21 am
by Doogee
its just really weird. it still wont work.
all that is meant to be in the default server is index.html, but it shows me the root of the virtual host instead. if i do
http://myip/blog/ it automatically changes the address bar to doogee.kicks-ass.org/blog/
Basically ive done alot of stuffing around to get the exact same thing as before.

Posted:
Sat Mar 13, 2004 10:40 am
by Void Main
And I still can't get to either your name or your address so I will be of no help. It sounds like a cache issue now though, either in your local browser or your proxy server. In fact I wonder if that is all you are currently getting because of the directory permissions.

Posted:
Sat Mar 13, 2004 10:43 am
by Doogee
well your getting what you meant to. i have nothing in the root of the virtualhost.
i have two directories, blog/ and forum/
i even tried using the local ip to goto
http://10.x.x.x/blog/ ad it redirected me to doogee.kicks-ass.org/blog