banner
Dave Horner's Website - Yet another perspective on things...
Home Tech Talk Unix/Linux/BSD/OSX/ETC Apache and LAMP Notes
If you appreciate the information found on this website, please drop me a line!

Who's Online

We have 20 guests online
Content View Hits : 1157143
moon and stars
How did you find my site?
 
How often do you answer random online questions?
 

Random Quote

"Being a robot’s great, but we don't have emotions, and sometimes that makes me very sad."
--Bender, Futurama
PANA0065
100_1519
DCP00054
P1010219

Apache and LAMP Notes

Thursday, 05 January 2006 20:36
Apache is a great webserver. It does the job very well. It has a lot of modules and configuration options. It isn't a small implementation, but it is a good one.
Welcome! - The Apache HTTP Server Project


I usually build apache from source. However, on windows, I like to install the LAMP stack installers...there are many. It is nice because they include a lot of other things like Mysql, PHP, PERL, mingw, etc. For Perl and mod_perl, you need to install an add-on.
apache friends - xampp for windows
Rob’s Notebook » XAMPP - misc documents relating to XAMPP (like securing it)

Build apache from subversion

#!/bin/bash
svn checkout http://svn.apache.org/repos/asf/httpd/httpd/trunk/ http.trunk
cvs -d :pserver:
  This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 :/repository checkout -d php5.2 -r PHP_5_2 php5




SSL Setup

The Linux Titbits - Sign your own certificate with OpenSSL
Note: you can not run multiple virtual hosts on the same IP.  You must have a separate IP and or Port for this to work.  This is because SSL is wrapping the HTTP proto.  I've hyperlinked some info about this in the SSL/TLS Strong Encryption: FAQ, by the way, you really should read the FAQ before you waste your afternoon.

Also, if you are interested in reading more on the problems with name based SSL hosting read this.
A good read on things you can do with the openssl tools.  Real-world uses for OpenSSL

Creating new SSL certs is a straight forward process.
openssl req -new -x509 -days 356 -nodes -out server.crt -keyout server.key

These files are not encrypted by default and don't have a pass phrase, so Apache will restart without requesting a password.

You may create a wildcard SSL certificate which covers many subdomains (*.mydomain.com).  This is nice for when you want to have a single SSL cert that can cover multiple hosts (using one IP)... I have heard rumors that it doesn't work in all browsers... but I haven't run into any issues with it.

Apache Out Of Control

Apache sometimes acts up on my systems... I still have yet to figure out why this is.... but I've at least found a solution that gets my machine up and runnning.

Sometimes I login to find MANY httpd processes running zombied or non-responsive.  I quickly try to shut down the service using the service scripts, however, the httpd processes stick around.  Then I do a trusty killall httpd in hopes that will take care of it.  Many times I've had to even set a -9 level for the kill to actually work.

Then, you should make sure to clean up the lock files as well as the semaphores left hanging.

The lock file comes first, delete /var/lock/subsys/httpd.  If you don't do this, you might get the error "httpd dead but subsys locked".


Then list all the semaphores by the user that runs as apache.
ipcs -s | grep apache

If there are a bunch of random open semaphores owned by the apache user, then delete them with the following command.
ipcs -s | grep apache |  perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'


If you don't do this, you run the risk of allowing apache to eat up all your system semaphores which leads to errors like "no space on device", which is very hard to understand at first because your first thought is.... I have space on the drive!!!


Web Resources

Apache2, WebDAV, SSL and MySQL: Life In The Fast Lane
Apache2-SSL-PHP5-Howto (+ Zend Optimizer And IonCube Loader) | HowtoForge - Linux Howtos and Tutorials


CAPTCHA

Doesn't really belong here, but i dunno where else to put it.
reCAPTCHA: Stop Spam, Read Books
PHP CAPTCHA Library for reCAPTCHA
ImageShield as CAPTCHA - VidoopSecure Strong Authentication Demo


mod_rewrite

.htaccess tricks and tips.. part two: url rewriting with mod rewrite.


mod_python | ThoughtSpark.org - has some mod_python code to do auth in python...


Apache Log Management

Apache will log to a single file if you ask it to. Backing up log files can be problematic. Managing log files requires careful consideration.
rotatelogs - Piped logging program to rotate Apache logs - Apache HTTP Server
cronolog - The cronolog package consists of two programs: cronolog and cronosplit.
Changing Apache log rotation behaviour on CentOS / RHEL - (uses logrotate)default install of CentOS or Red Hat Enterprise Linux, the log rotation script will automatically rotate the Apache log file each day and then reload the httpd service. This post looks at how to prevent this action from occuring automatically, or to change the behaviour to rotate the log files if your naming convention for log files is different from the default.
Apache Log Rotation « Sachin’s Weblog - talks a bit about rotatelogs...
Rotating Apache log files using Cronolog - Night Dreaming (by Sudar)
OutOfOrder.cc :: mod_log_sql - mod_log_sql is a logging module for Apache 1.3 and 2.0 which logs all requests to a database.
Writing Apache's Logs to MySQL - O'Reilly Media

Apache Performance

Basic Apache Performance Tips « hurikhan’s Thoughts - interesting to note on this list... 2) Combine your per-vhost logging into one monolithic site-wide log file, 3) Use piped logging instead of direct file logging.

Last Updated on Wednesday, 23 November 2011 08:58