2011/11/09

Apache Plone Maintenance

檢查已啟用的 module 清單:

$ ls /etc/apache2/mods-enabled/
alias.conf            authz_host.load  deflate.conf  mime.load         setenvif.load
alias.load            authz_user.load  deflate.load  negotiation.conf  status.conf
auth_basic.load       autoindex.conf   dir.conf      negotiation.load  status.load
authn_file.load       autoindex.load   dir.load      reqtimeout.conf
authz_default.load    cgid.conf        env.load      reqtimeout.load
authz_groupfile.load  cgid.load        mime.conf     setenvif.conf

確認啟用 proxy 不然會遇到錯誤: Invalid command 'ProxyPass', perhaps misspelled or defined by a module not inclu ded in the server configuration

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod rewrite
$ sudo vim /etc/apache2/sites-available/www.mysite.com
$ sudo a2ensite www.mysite.com
$ sudo /etc/init.d/apache2 restart

設定內容範例如下:

<VirtualHost *:80>
  ServerName www.mysite.com

  ErrorLog /var/log/apache2/mysite_error.log
  CustomLog /var/log/apache2/mysite_access.log combined
  LogLevel warn

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteLog /var/log/apache2/mysite_rewrite.log
  RewriteLogLevel 5
  RewriteRule ^($|/.*) http://127.0.0.1:6543/VirtualHostBase/http/www.mysite.com:80/mysite/VirtualHostRoot$1 [L,P]
</IfModule>

   ProxyPass / http://localhost:6543/mysite
   ProxyPassReverse / http://localhost:6543/mysite
  <Proxy *>
      Order deny,allow
      Allow from all
  </Proxy>

</VirtualHost>

沒有留言: