Posts Tagged ‘ Server

使用 .htaccess 自订“404 找不到网页”的页面

一般我们租用的虚拟主机无法让我们修改 httpd.conf,所以只能透过使用 .htaccess 来自订“404 找不到网页”的页面。

Read more

各 ISP 的寄件服务器(SMTP)

各 ISP 的寄件服务器(SMTP)

  • 中华电信(Hinet): msa.hinet.net 168.95.4.211
  • 数位联合(SeedNet): tpts5.seed.net.tw 139.175.54.240
  • 和信超媒体(Giga): smtp.giga.net.tw 203.133.1.121
  • 台湾索尼(So-net): so-net.net.tw 61.64.127.16
  • 速博: mail.sparqnet.net 211.78.130.150
  • 台湾固网: smtp.anet.net.tw 61.31.233.92
  • 亚太线上: mail.apol.com.tw 203.79.224.61
  • 东森宽带: ethome.net.tw 210.58.94.72
  • 悉达资讯: smtp.seeder.net 202.43.64.73
  • 将邮件服务器换成 Postfix + pop-before-smtp *

    故名思意,pop-before-smtp 就是在 smtp 前,先用 pop3 的帐号登入,以确保服务器上有你的帐号。以下的步骤,先将 Sendmail 换成 Postfix,再将 smtp 的认証则改用 pop-before-smtp 的方式。

    安装 Postfix

  • 先移除 sendmail:
  • apt-get remove sendmail
  • 使用 apt 安装 postfix:
  • apt-get install postfix
  • 编辑 /etc/postfix/main.cf,搜寻之参数及修改方式如下:
  • myhostname  ->  host.example.com
    mydomain  ->  example.com
    myorigin  ->  $myhostname
    inet_interfaces  ->  all
    mydestination  ->  /etc/postfix/local-host-names
    mynetworks  ->  127.0.0.0/8, hash:/etc/postfix/access
    relay_domains  ->  $mydestination
    alias_maps  ->  hash:/etc/postfix/aliases
  • 设定本机收件时的领域名称,将领域名称新增到 /etc/postfix/local-host-names,每个名称占一行:
  • example.com
    mail.example.com
    host.example.com
  • 初始化相关数据库:
  • postmap hash:/etc/postfix/access
    postalias hash:/etc/postfix/aliases
  • 至此已完成 Postfix 的安装,直接启动 Postfix 即可:
  • service postfix start

    安装 pop-before-smtp

    顾名思义,pop-before-smtp 就是在寄信前,必须先用 pop3 检查邮件,只要 pop3 登入正确,你就可以用同一台服务器寄信 (30分钟内)。安装步骤如下:

  • 安装 Perl 的 File::Tail、Time::HiRes、Net::Netmask、Date::Parse 模组,建议使用 WebMin 安装,或执行下列指令:
  • perl -MCPAN -e 'install File::Tail'
    perl -MCPAN -e 'install Time::HiRes'
    perl -MCPAN -e 'install Net::Netmask'
    perl -MCPAN -e 'install Date::Parse'
  • 从本站下载 pop-before-smtp 的安装档至 /tmp,并执行安装:
  • cd /tmp
    wget http://www.vixual.net/download/source/postfix/pop-before-smtp-1.33-1.noarch.rpm
    rpm -ivh pop-before-smtp-1.33-1.noarch.rpm
  • 编辑 /etc/pop-before-smtp-conf.pl,将下列三行前的注解 # 拿掉:
  • #$file_tail{'name'} = '/var/log/maillog';
    #$grace = 30*60;
    #$dbfile = '/etc/postfix/pop-before-smtp';
  • 编辑 /etc/postfix/main.cf,在最后面加上:
  • smtpd_recipient_restrictions = permit_mynetworks,reject_non_fqdn_recipient,check_client_access hash:/etc/postfix/pop-before-smtp,check_relay_domains
  • 启动 pop-before-smtp,并重新加载 postfix:
  • service pop-before-smtp start
    service postfix reload

    return top