ubuntu+apache上使用mod_rewrite和mod_ssl

ubuntu 12可方便的安装LAMP套装,安装完毕后apache即运行于ubuntu上了。
apache默认是支持mod_rewrite的,但是,在ubuntu上,这还是需要手动开启的!
首先,运行
sudo a2enmod rewrite
开始mod_rewrite,再重启apache
sudo service apache2 restart
如果在.htaccess上使用rewrite则需要更改默认apache站点设置,使得站点支持.htaccess
修改 /etc/apache2/sites-available/default
将 AllowOverride None 改为 AllowOverride FileInfo.
改完是这样的:

Options Indexes FollowSymLinks MultiViews
# changed from None to FileInfo
AllowOverride FileInfo
Order allow,deny
allow from all

同样,mod_ssl模块也需要激活:
a2enmod ssl
a2ensite default-ssl
ssl运行于443端口,如果你要将你的站点完全运行于https还需要进一步设置等等
再次重启,应该OK啦!

thanks http://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache https://help.ubuntu.com/10.04/serverguide/httpd.html