In this episode of Moving to FutureHosting, I’ll be installing and configuring Apache2, the mpm-worker multiprocessing module, passenger (aka mod_rails), Ruby, Ruby on Rails, and all associated cruft. I’ve done this before on Ubuntu using aptitude, but since FutureHosting runs CentOS, which uses the yum package manager, this will be a new experience for me.
My FutureHosting box came with Apache2. /usr/sbin/httpd -v reports Server version: Apache/2.2.9 (Unix), which seems fine.
Apache2 supports multiple concurrency models for handling more than one connection at once. Each model is implemented in a Multi-Processing Model (MPM). prefork-mpm causes Apache to fork off a number of processes on startup, each of which will process some requests. worker-mpm creates multiple worker threads within a process to handle requests.
I added a self-signed cert to apocryph.org, to protect passwords and sensitive content from nosy corporate networks. You can now browse apocryph.org via the https:// prefix.
I used a self-signed certificate, which isn’t as secure as a cert you’d buy from VeriSign or Thawte or whatever, but it’s also free. For thwarting casual eavesdropping attacks (and, for saavy users at least, MiTM attacks too), it gets the job done.
Recently I had cause to set up a WordPress blog engine on a virtual host on bonzo. My experience follows:
First I need to set up DNS for the domain. The owner of the domain used the registrar’s control panel to set the authoritative nameservers to ns1.afraid.org through ns4.afraid.org, which are the nameservers provided by FreeDNS.
Next, I log into my FreeDNS account, add the new domain to my domains, and point the domain and www. to bonzo’s IP address. I don’t have mail setup yet, so I’ll ignore the MX record for now.
Now, querying the domain in a web browser should bring me to my site on bonzo…sure enough, it does.
I just recently upgraded bonzo to Apache 2.2. I noticed that user directories, (eg, apocryph.org/~anelson mapping to /home/anelson/public_html/ don’t work anymore. What gives?
The httpd.conf entry in question is:
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root toor daemon operator bin tty kmem games news man sshd bind proxy _pflogd uucp pop www nobody mailnull smmsp
Today I went to slightly change my Apache 2.0 config on bonzo, when was greeted with a nasty error when trying to restart the process:
bonzo# apachectl restart
/libexec/ld-elf.so.1: Shared object "libexpat.so.5" not found, required by "httpd"
I suspect this is due to some of the upgrading it with with the ports tree recently. Obviously something needed a new version of libexpat, which broke my older build of Apache. I put a band-aid on the problem with:
ln -s libexpat.so.6 libexpat.so.5
in /usr/local/lib, but I don’t like running older versions of software. I noticed that Apache 2.2 is now out and in the ports tree under www/apache22. The upgrade instructions seem fairly straightforward, so I’m going to go for it.
I just installed the apache2 and php5 ports on aenea, and found that accessing .php files via Apache returned the PHP source code, instead of running the PHP server-side.
I had to add the following entries into /usr/local/etc/apache2/httpd.conf in order to get mod_php to pick up the files:
#Register PHP mime types
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
That worked, but index.php wasn’t run automatically if I navigate to a directory. For that I added index.php to the end of the DirectoryIndex directive:
DirectoryIndex index.html index.html.var index.php