postfix and virtual hosts or domains tutorial

I have Apache 2 configured with VirtualHost’s. So I have my domains for example http://mydomain1.com and http://sampledomain.com running on my machine. What about mails now? What about postfix?

For arriving mail:

  1. Edit “/etc/postfix/main.cf” and add there:
          virtual_alias_domains = mydomain1.com, sampledomain.com
          virtual_alias_maps = hash:/etc/postfix/virtual
        
  2. Edit or add “/etc/postfix/virtual”:
          @mydomain1.com user1
          homer@sampledomain.com user2
        
    This means that all mail for domain mydomain1.com should be delivered to local user account user1 (/home/user1 or whatever). This means also that mails for homer@sampledomain.com will be delivered to local user account user2.
  3. Execute:
          cd /etc/postfix
          postmap virtual
          /etc/init.d/postfix restart
        

For departuring mail (mails sent form local accounts to the Internet):

  1. Edit “/etc/postfix/main.cf” and add there:
     
          smtp_generic_maps = hash:/etc/postfix/generic
        
  2. Edit or add “/etc/postfix/generic”:
          user1@ubuntu-1004-lucid-64-minimal user1@mydomain1.com
        
    So mails sent from local accunt user1 will be sent into the Internet as user1@mydomain1.com.
  3. Execute:
          cd /etc/postfix
          postmap virtual
          /etc/init.d/postfix restart
        

Further information in here http://www.postfix.org/VIRTUAL_README.html#virtual_alias and in here http://www.postfix.org/ADDRESS_REWRITING_README.html#generic.

Posted by wojtek Fri, 23 Jul 2010 11:04:00 GMT




running rspec in aptana rad rails

Problem: I wanted to run a rspec in Aptana RadRails as a Test::Unit Test (Alt+Shift+X U) I have a spec/controller/my_controller_spec.rb file generated by rspec_controller generator. While running it in Aptana I got:

./spec/controllers/my_controller_spec.rb:1:in `require': no such file to load -- spec_helper (LoadError)

The solution is to change what the generator generated. Replace in the file:

require 'spec_helper'

with:

require 'spec/spec_helper'

This should help. Running this rspec through rake (rake spec) should work still as well.

Posted by wojtek Wed, 21 Jul 2010 13:42:00 GMT




problem starting sphinx with rials

Problem:


When doing:

rake thinking_sphinx:index

you get:

undefined method `[]' for false:FalseClass

Solution: remove the empty config/schema.yml file.

Posted by wojtek Tue, 20 Jul 2010 21:17:00 GMT