Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Apache config help
PostPosted: Sun Aug 24, 2014 2:43 pm 
Offline
Newbie

Joined: Sun Aug 24, 2014 2:15 pm
Posts: 3
Hi,

My apache server responds to requests for domains that it is not configured for. There is something wrong with my virtual host configuration. Though, I tried a couple of different things myself, I couldnt solve it yet.

I have 4 sites configured on my apache.

1- example.com.conf
Code:
<VirtualHost *:80>                                                                                    
     ServerAdmin admin@example.com                                                                   
     ServerName www.example.com                                                                     
     DocumentRoot /var/www/example.com/public_html/                                                   
     ErrorLog /var/www/example.com/logs/error.log                                                     
     CustomLog /var/www/example.com/logs/access.log combined                                         
</VirtualHost>


2- drop.example.com.conf
Code:
<VirtualHost *:80>                                                                                    
     ServerAdmin admin@example.com                                                                   
     ServerName drop.example.com                                                                     
     DocumentRoot /var/www/drop.example.com/public_html/                                                   
     ErrorLog /var/www/drop.example.com/logs/error.log                                                     
     CustomLog /var/www/drop.example.com/logs/access.log combined                                             
</VirtualHost>


3- webmail.example.com.conf
I use this only to forward http requests to https
Code:
<VirtualHost *:80>                                                                                    
     ServerAdmin admin@example.com                                                                   
     ServerName webmail.example.com                                                                 
     Redirect / https://webmail.example.com                                                           
</VirtualHost>


4- s.webmail.example.com.conf
Code:
<IfModule mod_ssl.c>                                                                                  
        <VirtualHost *:443>                                                                           
     ServerAdmin admin@example.com                                                                   
     ServerName webmail.example.com                                                                   
     DocumentRoot /var/www/webmail.example.com/public_html/                                           
     ErrorLog /var/www/webmail.example.com/logs/error.log                                             
     CustomLog /var/www/webmail.example.com/logs/access.log combined                                 
                                                                                                     
SSLEngine on                                                                                         
                                                                                                     
SSLCertificateFile      /etc/ssl/localcerts/example.pem                                             
SSLCertificateKeyFile /etc/ssl/localcerts/example.key                                               
                                                                                                     
                                                                                                     
        </VirtualHost>                                                                               
</IfModule>



Everything works fine with this config but the problem is it also works extra.
I have an DNS entry like xyz.example.com and when I try to reach that domain name through my browser like http://xyz.example.com Virtual Host #2 is being served and when I try to reach it with a secure connection like https://xyz.example.com the site #4 is being served by apache.

I don't want that. I don't want any sites being served from my apache unless I specifically configure for it and yet I don't have a configuration for xyz.example.com

I tried a couple of things myself, like using ServerAlias directive and some more but didn't help so far.

Please help me to configure my apache properly.

Thanks...


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 3:22 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Try running this command

Code:
commandX 


If that doesn't work, try

Code:
commandY

followed by
Code:
commandZ


Or maybe you could post the real info so that people don't have to waste their time playing 20 questions.

Repeat this little mantra a few hundred times: "Security thru Obscurity is a MYTH"

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 3:37 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
This explains what Apache is doing: https://httpd.apache.org/docs/2.2/vhosts/details.html

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 3:52 pm 
Offline
Newbie

Joined: Sun Aug 24, 2014 2:15 pm
Posts: 3
@vonskippy

Thank you so much for taking the time, appreciated.
I hope you solve you issues (whatever they are) and be happy with your life soon.


vonskippy wrote:
Try running this command

Code:
commandX 


If that doesn't work, try

Code:
commandY

followed by
Code:
commandZ


Or maybe you could post the real info so that people don't have to waste their time playing 20 questions.

Repeat this little mantra a few hundred times: "Security thru Obscurity is a MYTH"


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 4:06 pm 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
vonskippy is critical of people who ask for help, yet obscure publically available information (server names, etc). Most of the rest of us just ignore posts like that. If we can't see it, we can't help fix it.

_________________
/ Peter


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 9:29 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
duraturk,
In case you haven't resolved your issue yet you should know that the 'default' site served is the first to occur alphabetically in your sites-available directory. This happens when your IP address is used to connect to your server or a subdomain that isn't defined in a vhost file. BTW, if you use a '@' A Record in your DNS any subdomain will end up getting to your server.

What I do is set up a vhost file for my server's IP address (filename is the IP address and the ServerName is the IP address). The index.html file is empty so any access via the IP address or a non-existent subdomain ends up serving up the empty page. This works because alphabetically the IP address occurs before any alphabetic site.


Top
   
 Post subject: Re: Apache config help
PostPosted: Sun Aug 24, 2014 11:41 pm 
Offline
Newbie

Joined: Sun Aug 24, 2014 2:15 pm
Posts: 3
Ohhh yeah, I did like you said and it works just fine :)
Thank you so much....


Main Street James wrote:
duraturk,
In case you haven't resolved your issue yet you should know that the 'default' site served is the first to occur alphabetically in your sites-available directory. This happens when your IP address is used to connect to your server or a subdomain that isn't defined in a vhost file. BTW, if you use a '@' A Record in your DNS any subdomain will end up getting to your server.

What I do is set up a vhost file for my server's IP address (filename is the IP address and the ServerName is the IP address). The index.html file is empty so any access via the IP address or a non-existent subdomain ends up serving up the empty page. This works because alphabetically the IP address occurs before any alphabetic site.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group