Guest turi Posted August 27, 2003 Report Share Posted August 27, 2003 I want to have 2 websites on my server. I currently don't have a domain for my default page, however, my friend, does have one and we want to host that one on my Mandrake 9.1. I've tried lots to get this working with lots of documentation from Apache, but no go. Part of the problem I think is that my default page I access by typing in the IP address of the server (this is the /var/www/html default path which I am building my own homepage). Then there is my friend's webpage. So I have to problems. How do I get it to work first, then when I do, how do I have it so that only when the domain name is typed in, does it go to the specified directory, and when it is not, it goes to the default (typing in IP address for example). This is what I have for my Vhosts.conf: NameVirtualHost * <VirtualHost _default_:80> DocumentRoot /var/www/html ... </VirtualHost> <VirtualHost *> ServerName stubleu.mikeytheman.com ServerAlias www.stubleu.mikeytheman.com DocumentRoot /home/michael/public_html CustomLog logs/stubleu.mikeytheman.com-access_log combined </VirtualHost> Permissions on both directories have the "Read" on "Other". What I get when trying IP, loopback or domain name is this: Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. Now, if I don't have the <VirtualHost _default_:80> part, I get: An error occured while loading http://www.stubleu.mikeytheman.com: Could not connect to host www.stubleu.mikeytheman.com (Same message for trying my IP) I'm missing something really small because it can't be that complicated. Any help is appreciated!!! Thanks!!! Quote Link to comment Share on other sites More sharing options...
MottS Posted August 27, 2003 Report Share Posted August 27, 2003 Hi turi What about for /etc/httpd/conf/vhosts/Vhosts.conf Port 80ServerRoot /etc/httpd ResourceConfig /dev/null AccessConfig /dev/null NameVirtualHost * <VirtualHost *> ServerName YourDomainName.com ServerAdmin Whatever@hotmail.com DocumentRoot /var/www/html/SpecialDirectory </VirtualHost> <VirtualHost *> ServerName * ServerAdmin Whatever@hotmail.com DocumentRoot /var/www/html </VirtualHost> Because according to THIS, first VirtualHost in config file is priorized. So Apache will check if the client typed 'YourDomainName.com' and direct to /var/www/html/SpecialDirectory and if the client typed something else (ie *) then it will direct to /var/www/html. Now, all your DIRECTORIES have to be READ and EXECUTABLE by 'others' but NOT WRITE. The FILES, however, only have to be READ by 'others'. [root@localhost vhosts]# ls -l /var/www/html/ total 372 drwxrwxr-x 2 root root 4096 mar 4 00:38 Air Cargo/ -rw-r--r-- 1 root root 2326 mar 4 00:38 apache_pb.gif drwxrwxr-x 2 root root 4096 aoû 22 23:17 Bike/ drwxrwxr-x 2 root root 4096 avr 5 07:50 Buggy/ -rw-r--r-- 1 root root 12891 mar 4 00:38 caffeine.gif drwxrwxr-x 4 root root 4096 aoû 24 14:25 DepartManu/ drwxrwxr-x 2 root root 4096 aoû 1 00:15 History/ -rw-r--r-- 1 root root 5881 avr 30 21:58 index.html drwxrwxr-x 8 root root 4096 mar 4 00:38 MDKLinux/ -rw-r--r-- 1 root root 6965 mar 4 00:38 MDKlinux.jpg -rw-r--r-- 1 root root 1478 mar 4 00:38 msfree.png -rw-r--r-- 1 root root 233573 aoû 15 11:54 Receipe_PostOffice.jpg -rw-r--r-- 1 root root 56859 aoû 26 22:15 T1000.png -rw-r--r-- 1 root root 998 aoû 26 22:15 Uptime.png -rw-r--r-- 1 root root 6340 mar 4 00:38 WelcomeBonjour.png Hope this helps MOttS Quote Link to comment Share on other sites More sharing options...
Guest turi Posted August 27, 2003 Report Share Posted August 27, 2003 Port 80 ServerRoot /etc/httpd ResourceConfig /dev/null AccessConfig /dev/null Do I need to put this in the Vhosts.conf? I thought that it was handled by httpd2.conf. Should I add therefore, duplicate entries? I have in that same document "Server Root /etc/httpd/2.0" "Port 80" But the other 2, I can't find in either document. Should I look elsewhere for it? Or just addd them to the Vhosts.conf? I appreciate your help! Quote Link to comment Share on other sites More sharing options...
MottS Posted August 27, 2003 Report Share Posted August 27, 2003 Oh ok you have Apache 2. You should keep your stuff .. you only need the virtualhost thing actually .. MOtTs Quote Link to comment Share on other sites More sharing options...
Guest emetib Posted August 27, 2003 Report Share Posted August 27, 2003 question? i know that you said you will be running virtual hosts, but are you going to have them on different nic cards? if so then set up your listen to each site for the card that you want. if not, then you will have to have this line in your Vhosts.conf file- NameVirtualHost 10.0.0.2 that goes before any of the listings for the virtual hosts. if you don't have that line, the first site will always be the default and you won't be able to access the other site from the web. change the ip to what your's is and your set. Quote Link to comment Share on other sites More sharing options...
Guest turi Posted August 28, 2003 Report Share Posted August 28, 2003 Works! It was the "*". I put my IP address in there and it works fine now. But I thought you could enter the wildcard in case your IP changes? Isn't that it? That's what I would like because I don't have a static IP. As for the "ServerAdmin", what does that do? And also, "Custom logs", doesn't seem to work, do I have that right? Or do I even need it? Thanks! Quote Link to comment Share on other sites More sharing options...
Guest emetib Posted October 18, 2003 Report Share Posted October 18, 2003 Works! It was the "*". I put my IP address in there and it works fine now. But I thought you could enter the wildcard in case your IP changes? Isn't that it? That's what I would like because I don't have a static IP.As for the "ServerAdmin", what does that do? And also, "Custom logs", doesn't seem to work, do I have that right? Or do I even need it? Thanks! if your behind a router, it doesn't matter. the router is what gets it's ip from your isp. the router than sends out it's dhcp to your machines, your machines are what it looks for in the apache to get it's ip. the serveradmin is who will get emails if something is wrong. the custom logs, how do you have your's set up? this is mine. - CustomLog /var/log/httpd/cerberus_access_log common make sure that you have the space between access_log and common. it should work then. i have it on mine so that others that have sites on my server can have a sym link in their home to see the logs of their sites. most of the time they dont' have the perms to be able to see them. that's why i set it up like that. cheers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.