Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Wednesday, March 31, 2010

Apache modules

Modules are either compiled in (static) or dynamically loaded (shared).

List static with httpd -l
List all with httpd -t -D DUMP_MODULES

Shared modules are stored in /etc/httpd/modules/

Shared modules are either loaded directly in httpd.conf or by looking in conf.d/*.conf
E.g. conf.d/perl.conf
...
LoadModule perl_module modules/mod_perl.so
...

Here are some paths that are good to know (Apache on CentOS):
Executables /usr/sbin
Config /etc/httpd
Logs /etc/httpd/log
Web Root /var/www/html

Monday, March 22, 2010

Configure Apache for multiple instances of catalyst module in fastcgi

FastCgiServer /home/andreas/MyModule/script/pbweb_fastcgi.pl -processes 3
FastCgiServer /home/andreas/MyModule2/script/pbweb_fastcgi.pl -processes 3

NameVirtualHost *:80

<VirtualHost *:80>
ServerName a.xyz.com
Alias / /home/andreas/mymodulea/script/mymodule_fastcgi.pl/
</virtualhost>

<VirtualHost *:80>
ServerName b.xyz.com
Alias / /home/andreas/mymoduleb/script/mymodule_fastcgi.pl/
</virtualhost>

The end / after mymodule_fastcgi.pl is really important.

Configure Apache for multiple instances of catalyst module in mod_perl

The trick was to:
use virtual hosts
PerlOptions +Parent to create a new interpreter
PerlModule instead of PerlLoadModule which caused apache to crash

NameVirtualHost *:80

<VirtualHost *:80 />
ServerName a.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymodulea/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

<VirtualHost *:80 />
ServerName b.xyz.com
PerlOptions +Parent
PerlSwitches -IC:/mymoduleb/lib -IC:/morestuff/lib
PerlModule MyModule
<Location />
SetHandler modperl
PerlResponseHandler MyModule
</Location>
</VirtualHost>

Update
Sorry to say I only got this working on Windows since DBD:Pg caused error on CentOS.

Thursday, November 12, 2009

Some CentOS basics

First try
Some basic app admin
chkconfig, activate/deactivate services,
service, start and stop services
system-config-securitylevel

Get VNC up and running
Follow the instructions.
If you get an error that says bad display name when starting the vgcnserver at the end make sure that the machine recognizes it’s name. If not add it to /etc/hosts.
Open up the firewall for 5901 (and perhaps more) by running system-config-securitylevel

Apache
service httpd start
chkconfig httpd on
Works to connect from my windows machine after this

PostgreSQL
Followed the instructions approximately.
Got an error at the Starting postgresql service: prompt.
Read something about SELinux causing problems so I shut it down and rebooted and the server seems to be running. Don’t know if it was related with SELinux though.

Second try
During installation
For tasks, choose “Desktop – Gnome” and Server
Disable firewall and SELinux

Installed software
Perl 5.8.8
mod_perl 2.0.4
httpd 2.2.3
PostgreSQL not installed
Check installed version:

# rpm -q

VNC
As above.

PostgreSQL
8.3.6 install
# rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm
# yum install postgresql-server
Followed the book then a bit for initdb:

# su - postgres
-bash-3.2$ initdb
...
-bash-3.2$ exit
Start service and autostart at reboot:

# service postgresql start
# chkconfig postgresql on

Ended up with 8.3.9 but that should be ok.

Createuser and db:

# su - postgres
-bash-3.2$ createuser XYZ
-bash-3.2$ createdb -O XYZ XYZ

ftp
service vsftpd start
chkconfig vsftpd on

Add data to db
# psql -U XYZ < XYZ.sql

Apache
As above.

Perl stuff

Started with:

# yum install postgresql-devel.x86_64
# yum install gcc
since pg_config and gcc is needed when running:

# cpan install Bundle::DBD::Pg
When checking things out with get_datasources.pl (from the book) make sure to use a user that can read db and script. I added XYZ as a unix user and copied the script to ~ before getting it to work. Don’t know why though.

# cpan install Catalyst::Devel
Results in a million dependencies, just said yes to everything. Something was installed.

Open stuff for web development

CentOS