2011/11/26

rsync + ssh on different port

$ cat .ssh/config
Host another.site.IP
    Port 8022
    User marr
    Hostname another.site.com


$ rsync -av --progress --inplace --rsh=ssh another.site.com:my_folder/* my_backup

# and this is for normal cases:
$ rsync -av -e ssh myid@mysite.com:/my_folder/my_file .

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>