Confusion about sendmail and /etc/hosts
My Linode is running Ubuntu 9.04.
A few months ago I installed sendmail and in order for it to work I modified my /etc/hosts to be like this:
****127.0.0.1 localhost.localdomain localhost [hostname]
127.0.0.1 [hostname].localdomain
[IP] [external hostname].members.linode.com****
I don't understand why I did that, I just read it somewhere and it seemed to work.
Then about a month ago I realized many of the emails coming from my primary domain were being marked as spam because the headers had:
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
So I edited the /etc/hosts again and modified the first line to be:
127.0.0.1 [domain] localhost.localdomain localhost [hostname]
(I added the domain name that the emails were coming from to the first line)
This seemed to help. The email headers looked better and I was getting a lot less bounces.
However, today I rebooted my server and that latest /etc/hosts change took down my domain so a browser just showed "It Works!" (I guess I hadn't restarted Apache since then).
So it seems I have two choices:
(1) Be able to send emails that actually arrive at their destination
(2) Have a website that's actually live
I'm hoping there's a 3rd option that lets me have both
6 Replies
It definitely was that change because I've already removed my domain from the first line in /etc/hosts, restarted Apache and my site is up again.
I'm also totally confused why that would cause the "It Works!" problem
Email sent by
My hosts.conf is as follow:
127.0.0.1 localhost
xxx.xx.xxx.x yyxxx-x.members.linode.com mydomain.com
If I delete yyxxx-x.members.linode.com in my hosts.conf, then when trying to reach mydomain.com with a broswer, I obtain "It works". With
The Apache virtual host in charge of this domain looks like that:
<virtualhost *:80="">ServerName mydomain.com
ServerAlias www.mydomain.com</virtualhost>
Any ideas ?
127.0.0.1 localhost.localdomain localhost
10.10.10.10 server.example.com server
Where:
10.10.10.10 is replaced by the real IP address assigned to your Linode.
server is replaced by the name of your host in /etc/hostname (can be anything you want)
example.com is replaced by your real domain name.
This is what I have in my /etc/hosts. Start with that and move forward.
@vincemd:
I'm having a similar problem.
Any ideas ?
Edit /etc/apache2/sites-available/default
Default virtual host - replaces main server
Edit /etc/apache2/sites-available/example.net
ServerAlias
DocumentRoot "/home/girlie/public_html"
ScriptAlias /cgi-bin/ /home/girlie/cgi-bin/
Replace domains and users to match yours.
Then run a2ensite with the domain file name.