A quick newbie-question: how do you set up subdomains in Apache? What I want to do is this: I have a web site www.domain.com. Now I want to create a subdomain sub.domain.com, and when I enter it in my browser, I want to go to the same web site (www.domain.com). RedStar
You can do it with the ServerAlias directive. A little example: Code: <VirtualHost aaa.bbb.ccc.ddd> ServerName www.domain.com ServerAdmin [email protected] DocumentRoot /path/to/your/document_root ServerAlias sub.domain.com </VirtualHost> Jojo
hm...i have a question here ... i found on net a similar code with the one gived by jojo Code: Listen 80 NameVirtualHost * <VirtualHost *> ServerName www.domain.com DocumentRoot /home/httpd/htdocs/ </VirtualHost> <VirtualHost *> ServerName subdomain.domain.com DocumentRoot /home/httpd/htdocs/subdomain/ </VirtualHost> and i'm sure that it's gonna work ... but now a noomb question .... where do i paste this code in httpd.conf ? The begining of my httpd.conf looks like this ( i won't paste all file it's to large ) : Code: Listen 80 ServerRoot "/www/Apache2" DocumentRoot "/www/webroot" ServerName localhost:80 ServerAdmin admin@localhost ServerSignature On ServerTokens Full DefaultType text/plain AddDefaultCharset ISO-8859-1 Can anybody show me how should i modify the file ? That's all Thanq ps : and another noomb question .... witch of this two codes is better ?
This normally goes near the end of your httpd.conf. There should be an example section about virtual hosts. But it might also be in some included file. Which distribution do you use? They do pretty much the same.
First of all than'q for answering me falko Now ... i've got the apache instalation from http://www.devside.net/web/server/free/download ( setup 1.16 ) ... And about httpd.conf file ... it doesn't have any exemple ... i think it's not a very popular version of apache in all forums i looked the httpd.conf file looks different I hope that's not a problem I think it's easyer if i put the file ... and if u have time & wish to help me ... to solve it easyer . So here's the file And about the exemple u saied that it should be ... i found one in other file ( witch is in the same folder with httpd.conf ) named " httpd.default.conf " ... it has a lil' example at the end of the file .... here'is the file If this is what i searched i have to delet " # " before the example and replace it with the code i entered in first message ? Thank you again for your time
I'd put Code: Listen 80 NameVirtualHost * <VirtualHost *> ServerName www.domain.com DocumentRoot /home/httpd/htdocs/ </VirtualHost> <VirtualHost *> ServerName subdomain.domain.com DocumentRoot /home/httpd/htdocs/subdomain/ </VirtualHost> at the end of your httpd.conf and restart Apache.
i have a new problem i buyed a .ro domain and i have a problem with nameserver i need a program that makes nameserver on windows XP does anybody know such soft ?? I know that this is not the right topic to post this question but i didn't want to open a new topic Than'q
falko it's not working to put that code at the end of httpd.conf file i've put this Code: Listen 80 NameVirtualHost * <VirtualHost *> ServerName dutzzu.ro ServerRoot "/www/Apache2" DocumentRoot "/www/webroot" </VirtualHost> <VirtualHost *> ServerName poze.dutzzu.ro DocumentRoot "/www/webroot/poze" </VirtualHost> at the start of the file but it's not working too i want to make http://dutzzu.ro/poze to beacame http://poze.dutzzu.ro any ideeas ? Best regards , Dutzzu ps : i've solve the problem with the name'server ; a friend gived me a free software witch solved my probelm
What exactly is not working? Any errors? You can either redirect your users with a PHP script like this: Code: <?php header("Location: http://poze.dutzzu.ro"); exit; ?> or you use Apache rewrite rules: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
to the first question .... or i don't get any erorr but it's not working ... or i had an error msg with looked like this ( after i stopped and tryed to restart it again : Code: The Apache service could not be started A service specific error occurred: 1 More help is avaible by typing NET HELPMSG 3547 and if i type " net helpmsg 3547 it tells me " Reffer to the help or documentation for that service to determine the problem " Now ... i wasn't explicit enought ... i want to make avaible http://poze.dutzzu.ro .... it doesn't working now ... how can i make this subdomain to work ? thank you again for you time falko ps : that last url u gived me is in chinese i think ... don't understand it at all =))
Never seen a message like that. Which distribution do you use? Did you follow any of the "Perfect Setup" guides on HowtoForge to set the system up? Anything in Apache's error log? Do you want that domain to be a web site for itself or do you want to point that domain to an existing web site?
Well ... the ideea is that i buyed a .ro domain ( http://dutzzu.ro ) and i know how to make subdomains like this : http://dutzzu.ro/radio .... but i'd like this to apear like this : http://radio.dutzzu.ro this is all i want to do ps : as u realise it;s the same problem with http://dutzzu/poze ... witch i want to be : http://poze.dutzzu.ro
Do you want radio.dutzzu.ro to be a completely new web site, or just to point to the existing dutzzu.ro web site? Anyway, first of all you must create radio.dutzzu.ro in DNS.
I too is looking at creating subdomains I've given it ago only to get an error Code: oot@rockinghamgateway:/etc/apache2/sites-enabled# /etc/init.d/apache2 reload * Reloading apache 2.0 configuration... [Tue Jun 19 21:14:45 2007] [warn] VirtualHost cooper.rockinghamgateway.com:0 overlaps with VirtualHost cooper.rockinghamgateway.com:0, the first has precedence, perhaps you need a NameVirtualHost directive [ ok ] have you got a howto on creating subdomains any one care to explain how its done. why did Apache change so much or has it changed, I was use too the way tinysofa did it. I added my subs to the end of the httpd.conf file TT
What error did you get? What's the output of Code: apache2 -t ? If you like you can add your vhosts at the end of /etc/apache2/apache2.conf.
it says its ok Code: root@rockinghamgateway:~# apache2 -t Syntax OK I think i worked out the subdomains found a link on Ubuntu Not sure if its the correct way, but i followed what this person said http://ubuntuforums.org/showthread.p...ight=subdomain is a2ensite the same as linking it opps, can i have a live test please does the subdomain http://linux.rockinghamgateway.com work, it does my end. TT