比较穷,买不起独服 / 高端 VPS,只能拿 1GB 内存的破烂凑合一下建站。
众所周知,apache2
非常吃资源,经常内存就直接给吃满,所以这时候优化就显得十分重要。
(其实是懒得改成 nginx ///
有一句话要说在前头:“Linux配置速成,从入门到跳楼一步走”
很绝望,我去Google了一圈,都没有找到解决方法,还是我自己乱**试出来的。
我不想说话,只是默默的贴上配置。
依次遇到的错误:“Mail content denied”,“dovecot: auth: Fatal: No passdbs specified in configuration file. PLAIN mechanism needs one”,“ dovecot: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, waited 0 secs)”,“dovecot: imap(root): Error: Invalid settings in userdb: userdb returned 0 as uid”,“dovecot: imap(root): Error: Invalid user settings. Refer to server log for more information.”,“error: open database /etc/postfix/vmaps.txt.db: No such file or directory”,“postfix/trivial-rewrite[13636]: error: open file /etc/postfix/vhosts.txt: No such file or directory”,“Temporary lookup failure”
特别是下面这几个,弄了几百年才弄好:
“fatal: no SASL authentication mechanisms”,“ warning: SASL: Connect to private/auth failed: No such file or directory”,“Recipient address rejected: User unknown in local recipient table”,“Relay access denied”…
之前apache2的url重写一直开不起来,也搜了很多资料但都没有用。
最近终于找到了解决方法,其实很简单:
只需要
1 |
vim /etc/apache2/sites-available/000-default.conf |
1 |
然后修改 |
1 2 3 4 5 6 7 8 9 10 |
<VirtualHost *:80> <Directory /var/www/html/> Options FollowSymLinks #AllowOverride None 把None改为All使.htaccess作用在所有地方 AllowOverride All Require all granted </Directory> . . . </VirtualHost> |
最后,最关键的一步:
1 2 3 |
a2enmod rewrite //开启扩展,apache2专用 //或使用 ln -s /etc/apache2/mods-cuailable/rewrite.load /etc/apache2/mods-enabled/rewrite.load service apache2 restart |
然后就可以开心的使用啦!