First, using rsync mirror whole CPAN to local machine. Write rsync -avHP --delete rsync.nic.funet.fi::CPAN /var/www/CPAN >> /var/log/rsync.log 2>&1 into crontab for daily synchronization. This step supposes mirror site root is put at /var/www/CPAN.
Second, write apache VirtualHost as below.
<VirtualHost *>
ServerName cpan.yourdomain
DocumentRoot /var/www/CPAN
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/CPAN/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/cpan-error.log
LogLevel warn
CustomLog /var/log/apache2/cpan-access.log combined
ServerSignature On
</VirtualHost>
Restart your apache and access cpan.yourdomain. you can see it.
Third, register your mirror site at mirrors.cpan.org if you want to become a official mirror site.
No comments:
Post a Comment