apache, can't create (dynamic) server, Catalyst, fastcgi, FastCgiIpcDir, httpd.conf, Permission denied: FastCGI, Permission denied: FastCGI: can't create (dynamic) server
Day 12 – Configuring Catalyst and Apache
Well, now that I’m satisfy with my code base, I’m going to enable access to my Catalyst application through Apache server.
First thing I realize is that it uses FastCGI instead of mod_perl, the problem is that it doesn’t comes by default with Apache, then, need to install it.
- Install required packages
- yum install libtool httpd-devel apr-devel apr
- Download and uncompress source code from http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
- Compile
- cd <mod_fastcgi_dir>
- cp Makefile.AP2 Makefile
- As my Apache directory is different to /usr/local/apache2 I change it on Makefile
- top_dir = /usr/lib/httpd
- make
- If “build/special.mk: No such file or directory” error appears, install httpd-devel
- sudo make install
-
Add an entry to httpd.conf like this:
- <IfModule !mod_fastcgi.c>
LoadModule fastcgi_module modules/mod_fastcgi.soUser web
Group apache
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>
- <IfModule !mod_fastcgi.c>
- FastCGI creates temporal files and in the configuration we said that directory is /tmp/fcgi_ipc/ in order to avoid “Permission denied: FastCGI: can’t create (dynamic) server” error, you have to assign full permissions:
- mkdir /tmp/fcgi_ipc
- sudo 777 /tmp/fcgi_ipc
- mkdir /tmp/fcgi_ipc/dynamic
- sudo 777 /tmp/fcgi_ipc/dynamic
- Configure your app on httpd.conf
- #
################################################
# Perl Catalyst
# Allow CGI script to run
<Directory /system/path/to/yourapp>
Options +ExecCGI
</Directory># Tell Apache this is a FastCGI application
<Files yourapp_fastcgi.pl>
SetHandler fastcgi-script
</Files>RewriteCond %{HTTP:Authorization} ^(.+)
RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]# Serve static content directly
Alias /static /system/path/to/yourapp/root/static# In case you want your app be server on the root of the address, if not, assign other alias
Alias / /system/path/to/yourapp/script/yourapp_fastcgi.pl/
- #
- Restart Apache
- If you can’t see the Catalyst welcome page, check Apache’s error log and fix the reported error.
And that’s all (Actually I had to re-install Catalyst modules as root because my local installation were not reached by the Apache account)
From → 05 Deploying, JobFilter Perl