From e9caf5b0c0b07060ecf72feb2c5c0fb85a536c40 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 9 Apr 2014 22:52:07 +0000 Subject: [PATCH] Small tweaks --- .gitignore | 3 + www/PerlSiikir.html | 154 ++++++++++++++++++++++++++++++++++++++++++++ www/layout.html | 3 +- 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 www/PerlSiikir.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d50b505 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/www/static/photos/*.jpg +/www/static/photos/*.png +/www/static/photos/*.gif diff --git a/www/PerlSiikir.html b/www/PerlSiikir.html new file mode 100644 index 0000000..d9fcc40 --- /dev/null +++ b/www/PerlSiikir.html @@ -0,0 +1,154 @@ +{% extends "layout.html" %} +{% block title %}About Me{% endblock %} +{% block content %} + + +
+

+ + + +
+
+ + +

+

+

SiikirPerl

+

How to install the Perl Siikir CMS.

+

+

+
+

Perlbrew

+

Recommended to install a custom Perl w/ perlbrew instead of using your vendor +version of Perl. I made a dedicated user, bob that "owns" the Perl +installation.

+
+  [bob]$ sudo mkdir /opt/perl5 && chown bob:bob /opt/perl5
+  [bob]$ export PERLBREW_ROOT="/opt/perl5"
+  [bob]$ wget -O - http://install.perlbrew.pl | bash
+  [bob]$ perlbrew init
+  [bob]$ perlbrew install perl-5.18.0
+  [bob]$ perlbrew switch perl-5.18.0
+

After installing Perl, make a symlink so that /opt/perl points to the Perl +root, for example:

+
+  /opt/perl -> /opt/perl5/perls/perl-5.18.0
+

So that /opt/perl/bin/perl exists.

+

+

+
+

Apache Configuration

+

You'll need mod_fcgid, mod_rewrite, and probably mod_suexec. On +Debian, install the package apache2-suexec-custom so that you can change +suexec to use /home as its root (not needed if you plan to put your site +under /var/www). The suexec config file is usually at +/etc/apache2/suexec/www-data.

+

Typical VirtualHost configuration for mod_fcgid:

+
+  <VirtualHost *:80>
+    ServerName www.yoursite.com
+    DocumentRoot /home/www/public_html
+    CustomLog /home/www/logs/access_log combined
+    ErrorLog /home/www/logs/error_log
+    SuexecUserGroup www www
+    <Directory "/home/www/public_html">
+      Options Indexes FollowSymLinks ExecCGI
+      AllowOverride All
+      Order allow,deny
+      Allow from all
+    </Directory>
+    <Directory "/home/www/public_html/fcgi">
+      SetHandler fcgid-script
+      Options +ExecCGI
+      AllowOverride All
+      Order allow,deny
+      Allow from all
+    </Directory>
+  </VirtualHost>
+

Follow that up with a .htaccess in your document root:

+
+  <IfModule mod_rewrite.c>
+    RewriteEngine on
+    RewriteBase /
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteCond %{REQUEST_FILENAME} !-d
+    RewriteRule . /fcgi/index.cgi [L]
+    RewriteRule ^$ /fcgi/index.cgi [L]
+  </IfModule>
+

+

+
+

Perl Modules

+

The typical Siikir installation requires these modules. Install them using +cpanminus as your Perl user (bob in my case).

+
+  $ cpan App::cpanminus
+

The required modules (install each with cpanm $NAME):

+
+  CGI::Fast
+  FCGI
+  JSON
+  JSON::XS
+  Image::Magick*
+  LWP::UserAgent
+  Mail::Sendmail
+  Template*
+  Digest::SHA1
+  Net::DNS
+

You'll need JSON::XS. JSON::PP doesn't quite cut it.

+

A couple modules have special cases and might not be installable via cpanm:

+

+

+

Image::Magick

+

Because of Image::Magick's ties with the C ImageMagick library, they need to +be installed by hand. You'll need to download and build ImageMagick from +imagemagick.org (it includes the Perl module, so you don't need to deal with +CPAN at all for this one).

+
+  $ wget http://www.imagemagick.org/download/ImageMagick.tar.gz
+  $ tar -xzvf ImageMagick.tar.gz
+  $ cd ImageMagick-*/
+  $ ./configure --with-perl
+  $ make
+  $ make perl-sources
+  $ sudo make install
+  $ sudo ldconfig /usr/local/lib
+  $ cd PerlMagick
+  $ perl Makefile.PL
+  $ make
+  $ make test
+  $ make install
+

Note: If your site ever starts crashing (particularly after a software +update) saying it can't find libmagick.so or something, run +sudo ldconfig /usr/local/lib to rebuild the library cache.

+

+

+

Misc Notes

+

You'll need libperl-dev installed on the system (if you get an error like +"can't find -lperl" when building).

+

+

+

Template

+

I sometimes have problems installing Template::Toolkit through cpanm because +the test suite doesn't pass completely (35 out of several thousand tests fail). +You can just download and install this module by hand and it works.

+ +{% endblock %} diff --git a/www/layout.html b/www/layout.html index 1ac3a51..75bbecf 100644 --- a/www/layout.html +++ b/www/layout.html @@ -33,6 +33,7 @@ {% block content %}{% endblock %} {% if uri not in ["/", "/blog/index"] and not "/blog/category" in uri %} +
{{ leaderboard() }} {% endif %} @@ -160,4 +161,4 @@ - \ No newline at end of file +