Apache config help
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
<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
<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
<virtualhost *:80="">ServerAdmin admin@example.com
ServerName webmail.example.com
Redirect / https://webmail.example.com</virtualhost>
4- s.webmail.example.com.conf
<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
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…
6 Replies
commandX
If that doesn't work, try
commandY
followed by
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"
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:
Try running this command
commandX
If that doesn't work, try
commandY
followed by
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"
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.
Thank you so much….
@Main Street James:
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.