Voidmain's cool stuff

Place to discuss anything, almost. No politics, religion, Microsoft, or anything else that I (the nazi censor) deem inappropriate.

Voidmain's cool stuff

Postby Doogee » Fri Mar 12, 2004 6:43 am

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?
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Fri Mar 12, 2004 10:15 am

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.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Fri Mar 12, 2004 7:15 pm

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
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Fri Mar 12, 2004 7:40 pm

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".
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Fri Mar 12, 2004 9:44 pm

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
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Sat Mar 13, 2004 7:40 am

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.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Sat Mar 13, 2004 7:48 am

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?
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Sat Mar 13, 2004 8:17 am

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.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Sat Mar 13, 2004 9:45 am

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.
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Sat Mar 13, 2004 9:48 am

Can I see your config? You can upload it via ftp to my site (put it in /uploads).
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Sat Mar 13, 2004 9:51 am

Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Sat Mar 13, 2004 10:11 am

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.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Sat Mar 13, 2004 10:21 am

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.
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Sat Mar 13, 2004 10:40 am

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.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Sat Mar 13, 2004 10:43 am

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
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Next

Return to The Lounge

Who is online

Users browsing this forum: No registered users and 0 guests

cron