Tech Support Guy banner
Status
Not open for further replies.
1 - 15 of 15 Posts

· Registered
Joined
·
309 Posts
Discussion Starter · #1 ·
I've got Apache 2.0, and I was wondering if there was a way to make sub directories. I'm going to be hosting my friend's websites, and wanted to give each of them their own subdirectory. For example, i want http://localhost/Friend1/ to be: http://Friend1.localhost/. I want to know if this is possible and if it is, is it recomended. Mind you, I understand Apache ok, but I'm not a pro yet.
 

· Retired Trusted Advisor
Joined
·
19,935 Posts
In your apache config file you should see something that says: Name Virtual Host (Name Based Virtual Hosting). Are you running this on Linux or Windows. You should probably ask a moderator to move this topic to one of those forums.

Code:
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /home/username/html
    ServerName username.somedomain.com
    ServerAdmin [email][email protected][/email]
    ScriptAlias /cgi-bin/ /home/username/cgi-bin/
    ErrorLog logs/username.somedomain.com-error_log
    CustomLog logs/username.somedomain.com-access_log common
</VirtualHost>
You understand for this to work you will need to have DNS and a domain name.
 

· Registered
Joined
·
309 Posts
Discussion Starter · #3 ·
I am runing Windows 2000 Professional. Thanks for the quick reply. From my understaning, this will not work because I am not using a real domain name:
Code:
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /friend/html/
    ServerName friend.localhost/
    ServerAdmin [email][email protected][/email]
    ScriptAlias /cgi-bin/ /friend/cgi-bin/
</VirtualHost>
I am going to signup for URL forwarding at cjb.net. Will it work if I do that?
 

· Registered
Joined
·
309 Posts
Discussion Starter · #5 ·
I'm sorry, but I'm still not getting it. Could you, or someone, explain the steps in order to make a virtual host. Thanks!
 

· Registered
Joined
·
24 Posts
You will need a DNS if you want the Internet to "see" you.

I use http://www.dyndns.org/ they are rock solid. You can get a FREE domain for your system there.

To answer your question I will "assume" you have Apache 2.0 running and know where the www_docs directory is. I'm a Unix person, so bear with me, under where ever the WWW_DOCS directory is (where ever DocumentRoot is) you can just "create" subdirectories there same as you would for "regular" Win2k access. Those directories will be servable as

http://somehost.tld/directory1
http://somehost.tld/directory2
http://somehost.tld/directory1/anotherdirhere/

You still have to make sure you httpd.conf file is right - as indicated by the other poster.

HTH/Bill
 

· Registered
Joined
·
309 Posts
Discussion Starter · #7 ·
Ok, I've got a DNS up and running. It is http://xsever.serveftp.net Then, when I put this code into my http.conf, nothing works:
Code:
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /ben/html/
    ServerName ben.xsever.serveftp.net
    ServerAdmin [email][email protected][/email]
    ScriptAlias /cgi-bin/ /ben/cgi-bin/
</VirtualHost>
I've created the directories mentioned in the htdocs/ folder. I registed with dyndns.org. i registered a Dynamic DNS Service. Thanks for all the help thus far!
 

· Registered
Joined
·
24 Posts
DNS tries to resolve and connect to xsever.serveftp.net but cannot.

By adding ben to ben.xsever.serveftp.net you have created another (subdomain) host which doesnt resolve to anything.

Set
ServerName xsever.serveftp.net

or add more host records at your DNS provider...

HTH/Bill
 

· Retired Trusted Advisor
Joined
·
19,935 Posts
-SX- is correct. You would need to have a DNS record for ben.xsever.serveftp.net. But also realize that DNS sometimes takes up to 48 hours to propogate throughout the internet.

Make sure you have the proper permissions setup on the /ben and /ben/html directores. I personally would not have done it the way you did. I would have just created the html directory in the users home directory. But everyone does it differently. /home/ben/html

Just one more question. Did you restart the Httpd Daemon after you made the changes to the httpd.conf file.
 

· Registered
Joined
·
24 Posts
only difference between UserDIR public_html and /ben/html is the ~ in the URL...
insecurity.org/ben/

versus
insecurity.org/~ben/

Whether you use public_html or not you can set up viryal hostnames in DNS to have it resolve to

ben.insecurity.org or insecurity.org/~ben

Name based birtual hosting requires all vistors web browsers support HTTP/1.1 (or at least understand the HOST http command.)
 

· Registered
Joined
·
309 Posts
Discussion Starter · #12 ·
How do I make a DNS record?
 

· Registered
Joined
·
24 Posts
They count as MORE this way and I want me own Avatar =)
 
1 - 15 of 15 Posts
Status
Not open for further replies.
Top