Linux

Apache forward proxy

How to install a forward proxy:

  1. In a typical multi-host environment, you need to add a virtual server to the apache configuration. In order to do that, add a file (e.g. ForwardProxy.conf) to the sites-available directory. This file must contain the following configuration lines for the proxy to listen on port 8080:

    ProxyRequests On
    ProxyVia On

    Require ip 192.168

    ErrorLog /var/log/apache2/error_ForwardProxy.log
    CustomLog /var/log/apache2/access_ForwardProxy.log combined

Counting files (list and word count, ls & wc)

How do you count the number of files in a directory? That becomes non-trivial if you have thousands of files in a directory. Your file manager chokes on counting them, especially if they are not local. On the Linux command line, this task is fast and easy:
ls | wc
ls lists your files one per row and wc returns three numbers: lines, words and bytes. In the file counting example, lines and words are the same and equal the number of files in the directory.

Copying with rsync

rsync --progress --recursive source target
To resume a previously interrupted copy:
rsync --progress --recursive --ignore-existing source target

 
Please note that rsync source/ target and rsync source target do produce different results!

The trailing slash at the end of the source directory causes rsync to copy the contents of the source directory into the target directory. Without the trailing slash, the target directory will contain one directory that is identical to the source directory.

Pages