This is a discussion on Apache and Default vhost within the Linux Web Servers forums, part of the Web Server and Related Forums category; Help!, i ahve been struggeling with this problem for hours now, and have tried everything that i can find and ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Help!,
i ahve been struggeling with this problem for hours now, and have tried everything that i can find and think of!, i have a static ip and go through a modum/router and i think that i have sucessfuly allowed the ports to come through. The problem:- i have two vhosts, hoping that the first will be the default, when i ran a Vhost-dump i got:- VirtualHost configuration: *.*.*.*:80 is a NameVirtualHost default server www.MyDefaultServer.com (/(somewhere)/httpd.conf:724) port 80 namevhost www.MyDefaultServer.com (/(somewhere)/httpd.conf:724) port 80 namevhost www.MyPage.com (/(somewhere)/httpd.conf:751) wildcard NameVirtualHosts and _default_ servers: _default_:443 new.host.name (/(somewhere)/ssl.conf:90) (98)Address already in use: make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down Also, no matter what order i put the two hosts, when i call MyPage.com it automaticaly goes to the index.html page, when i call the MyDefaultServer.com page, it displays the index.html page of MyPage.com, further more when i type in MyDefaultServer.com/index.html it displays the right page!. What could i be doing wrong? Andrew |
|
|||
|
Andrew wrote:
> Help!, > i ahve been struggeling with this problem for hours now, and have > tried everything that i can find and think of!, i have a static ip and > go through a modum/router and i think that i have sucessfuly allowed > the ports to come through. > The problem:- > i have two vhosts, hoping that the first will be the default, when i > ran a Vhost-dump i got:- > > VirtualHost configuration: > *.*.*.*:80 is a NameVirtualHost > default server www.MyDefaultServer.com > (/(somewhere)/httpd.conf:724) > port 80 namevhost www.MyDefaultServer.com > (/(somewhere)/httpd.conf:724) > port 80 namevhost www.MyPage.com > (/(somewhere)/httpd.conf:751) > wildcard NameVirtualHosts and _default_ servers: > _default_:443 new.host.name (/(somewhere)/ssl.conf:90) > (98)Address already in use: make_sock: could not bind to address > 0.0.0.0:443 > no listening sockets available, shutting down > > Also, no matter what order i put the two hosts, when i call MyPage.com > it automaticaly goes to the index.html page, when i call the > MyDefaultServer.com page, it displays the index.html page of > MyPage.com, further more when i type in MyDefaultServer.com/index.html > it displays the right page!. > What could i be doing wrong? > Andrew Are you using Apache 1.3.x ? I am - and I've had similar problems with VirtualHosting before - I read this solution somewhere, and it works for me: In your httpd.conf file, check the following #Listen 3000 #Listen 12.34.56.78:80 NameVirtualHost * Therefore, the above has two lines that are disabled (the '#' character does this in the config file).... The NameVirtualHost has a single asterix, not an IP address in it. Lastly, at the very end of my httpd.conf file I have include "/data/www/config" Then, in /data/www/config I have individual files for each one of my virtual hosts - each has a specific configuration specific to that domain. Any file that sits in that directory is taken as configuration directives and are read as listed. I called my default file _default so when you do an ls -l it gets listed first... and started/answered first by the server for client requests. My /data/www/config/_default file looks like the following: <VirtualHost *> ServerName www.mydomain.com DocumentRoot /data/www/websites/mydomain.com/htdocs ErrorLog /data/www/logs/mydomain.com-err.log CustomLog /data/www/logs/mydomain.com-access.log combined </VirtualHost> You can have more than one configuration directive in each file, I do for some domains which have several sub-domains - The advantage to this method is I have all directives for a single domain in a single file... and any changes I do relate specifically to that domain, and not globally... However, any changes to the parent httpd.conf file will of course, make global changes. One last thing - I should stress that any files you have sitting under the directory you specify in the 'include' directive is taken to be a configuration directive thus you might find, like I have more than once, is that if you're editing a config file with 'vi' and restart Apache, that Apache fails to start - This can be because a ".swp" (vi swap file) exists in there, and it should clean up if you exit vi and then try start Apache again. I hope something above there helps you... randelld |
|
|||
|
Thanks Randell,
there was a Virtualhost name/ip/port problem, and in the end i managed to sort it out. Now that I have resolved that, I have another question/problem (i have looked for a solution on google but no luck), in my default virtualHost page i would like to have linked buttons to web pages that i will/am hosting on my server. So far hitting a button on the default page when viewing on the server machine it works (probably knows what to do), but when attempting to do the same think from a remote computer, it doesn't work, it "plugs" the url into the address bar, but as i am testing and not fully opperational, cannot find (i understand search engines). what i would like is if the default page could have a link to point to the directory index.html page in a) the same user, but different file (parralell), and eventualy to b) a file(s) in different users accounts. (i am using redhat 9 & apache 2) Thanks heeps Andrew |
|
|||
|
I have actualy an answer, but not quite as i'd liked, as when called
from a html page (like <a href="mysite/">mysite</a> ), an example below:- <virtualhost www.myhost.com> ServerName www.Myhost.com DocumentRoot /home/user/myhost/htdocs DirectoryIndex index.html ServerAdmin me@myhost.com AddHandler cgi-script pl cgi Alias /mysite/ /home/user/mysite/htdocs/ Alias /cgi-bin-mysite/ /home/user/mysite/htdocs/cgi-bin/ Alias /images-mysite/ /home/user/mysite/htdocs/images/ Alias /mysite2/ /home/user/mysite2/htdocs/ Alias /images-mysite2/ /home/user/mysite2/htdocs/images/ <Directory "/home/user/myhost/htdocs"> Options Indexes +Includes +FollowSymLinks +ExecCGI +MultiViews AllowOverride None Allow from all Order allow,deny </Directory> </virtualhost> <virtualhost www.mysite.com> ServerName www.mysite.com (yada yada yada) </virtualhost> <virtualhost www.mysite2.com> ServerName www.mysite2.com (yada yada yada) </virtualhost> the "kinda-problem" is that i have to specificaly name all the directories that go with the site, as in "images-mysite2", "images-mysite-1". What i want to achieve is to transfer the complete URL internaly, and not have http://www.MyHost.com/mysite/index.html, but have http://www.Mysite.com/ (i.e. a complete transfer) any suggestions anyone? Thanks Andrew |