jesseconsopolus Posted February 2, 2013 Share Posted February 2, 2013 Issue with virtual hosting on port 80. This is a KVM Debian Squeeze 6.X box if that make a diff. and it is NAME Based hosting not I.P. Issue is with the hosts overlapping and the first site is taking precedence. This would usually be caused by needing a VirtualHost directive (which is there). I have been on this issue for around 4 hours now. My google foo is top notch.. but everything I have read points to the httpd.conf file which I actually wrote and debugged, (bc deb's was empty) but Debian does not even use this file, I have the apache2.conf pointing to ports.conf which I created rather than httpd.conf. I also have all the sites-enabled configs set.... But I can use either, both, etc. if needed, (which I have tried). When I do use the httpd.conf file I have created, I then get the return Address already in use: make_sock: could not bind to address. I have set port to *:80 and also tried 127.0.0.1 vice versa and every other config you can think of. I have created a virtual.conf file as well to see if that would fix.. just caused apache2 to dump and not start... so basically back to square one... Funny thing is this box was working on Thursday and many months prior... not exactly sure what happened... Any help is much appreciated... This is my config file.. named 000-default located in the /etc/apache2/sites-enabled/ # # Use name-based virtual hosting. # NameVIrtualHost 127.0.0.1 <---- I have used this, the ip of server, as well as *:80, etc.. various others... <VirtualHost www.example site.com> ServerAdmin webmaster@example site.com ServerName http://ip of server/ DocumentRoot /var/www/www.example site.com <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride All Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> And here is the actual virtual site config... # # www.example site.com (/etc/apache2/sites-available/www.example site.com) # <VirtualHost www.example site.com> ServerAdmin webmaster@www.example site.com ServerName http://ip of server/ ServerAlias www.example site.com # Indexes + Directory Root. DirectoryIndex index.html DocumentRoot /var/www/www.example site.com # CGI Directory ScriptAlias /cgi-bin/ /var/www/www.example site.com/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /var/www/www.example site.com/logs/error.log CustomLog /var/www/www.example site.com/logs/access.log combined </VirtualHost> Which all look fine to me..... here is my /etc/hosts... 127.0.0.1 localhost 127.0.0.1 assisted-living-facility.com 127.0.0.1 retirementcommunitiesinflorida.com 127.0.0.1 pridemania.com 108.166.179.126 debian.mcalester.net debian # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters My ports.conf file is below..... # If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000/default # This is also true if you have upgraded from before 2.2.9-3 (i.e. from # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and # README.Debian.gz NameVirtualHost 127.0.0.1 Listen *:80 #<IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. # Listen 443 #</IfModule> #<IfModule mod_gnutls.c> # Listen 443 #</IfModule> I have just taken out the 443 for diag. purposes... everything is on 80.. Like I said before box was working on my first config just fine for many months... the box powered down thursday and now the issue... maybe a glitch in the matrix? Quote Link to comment Share on other sites More sharing options...
no42 Posted February 3, 2013 Share Posted February 3, 2013 (edited) This might help: http://www.debian-administration.org/articles/412 From what Ive noticed: <VirtualHost www.example site.com> should be <VirtualHost * > ServerName http://ip of server/ should be the name not ip e.g ServerName assisted-living-facility.com Edited February 3, 2013 by midnitesnake Quote Link to comment Share on other sites More sharing options...
jesseconsopolus Posted February 3, 2013 Author Share Posted February 3, 2013 (edited) Tried with that and got the NameVirtualHost has no virtual hosts... I edited the sites-available and sent recursive to sites-enabled, but still no go. The configs worked for quite some time... I ended up fixing by just deleting the KVM and starting all over. I think it was a problem with apache2. All the .conf files were working fine together. I was under the impression that the power down messed something up, turns out a customer to whom i gave access too deleted .htaccess and a ton of other files.... no telling. But it will be back up and running today. Thanks for the input. I did have a saved config with the <VirtualHost *>, so I will try that setup again and see what works to fix some apache start up issues..... NameVirtualHost 108.166.179.126 <VirtualHost *> ServerAdmin webmaster@www.pridemania.com ServerName www.pridemania.com ServerAlias www.pridemania.com # Indexes + Directory Root. DirectoryIndex index.html DocumentRoot /var/www/www.pridemania.com/ # CGI Directory ScriptAlias /cgi-bin/ /var/www/www.pridemania.com/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> ​ sorry to ask such a dumb q on here for the first couple of posts.... also found out that apache 2.XXX handles stuff way different than previous versions... so 2.XX will not handle the *:80 it will however handle the * properly... so if anyone has issues... Thanks for the reply midnitesnake... Edited February 4, 2013 by jesseconsopolus 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.