Apache

http://camel.apache.org/what-is-camel.html
http://httpd.apache.org/docs/current/howto/htaccess.html - continue reading from the "How directives are applied" section
http://speckyboy.com/2012/07/26/what-is-htaccess/
http://net.tutsplus.com/tutorials/apache-2-advanced-configuration-on-unix-like-systems
http://www.instantshift.com/2012/08/21/how-to-get-the-most-out-of-your-htaccess-file
http://corz.org/serv/tricks/htaccess.php
http://apache.slashdot.org/story/12/02/21/1632230/apache-24-takes-direct-aim-at-nginx
http://net.tutsplus.com/tutorials/apache-2-basic-configuration-on-unix-like-systems/
http://net.tutsplus.com/tutorials/apache-2-advanced-configuration-on-unix-like-systems/
http://net.tutsplus.com/tutorials/other/password-protect-folders-in-seconds/
http://net.tutsplus.com/tutorials/other/an-introduction-to-apache/
http://net.tutsplus.com/articles/news/htaccess-files-for-the-rest-of-us/
http://net.tutsplus.com/tutorials/other/a-deeper-look-at-mod_rewrite-for-apache/
http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/
http://net.tutsplus.com/tutorials/other/5-fun-and-practical-htaccess-solutions/
http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/
http://www.sitepoint.com/using-htaccess-prevent-web-scraping

http://furbo.org/2015/01/22/fear-china/ - done reading
http://speckyboy.com/2012/06/18/using-the-power-of-the-htaccess-file-to-improve-wordpress-seo/ - done reading
http://www.sitepoint.com/htaccess-for-all/ - done reading
http://net.tutsplus.com/tutorials/apache-aliasing-and-redirection/ - done reading
http://code.tutsplus.com/tutorials/apache-aliasing-and-redirection--net-28606 - done reading

Proxy
Sending Apache Logs to Syslog
.htaccess
Security and Performance
VirtualHost
mod_rewrite
Misc

cometd

Various non-HTTP-related projects from ASF

How can we check if the configuration files are valid?

httpd -S

How can we start or stop apache using a different configuration file?

/usr/sbin/httpd -k start -f /etc/httpd/conf/httpd.conf
/usr/sbin/httpd -k stop -f /etc/httpd/conf/httpd.conf

How can we start apache in single process mode?

/usr/sbin/httpd -k start -X -f /etc/httpd/conf/httpd.conf

Problem with single process mode and share memory

If you frequently restart your sandbox in single process mode, occassionally you may get an error "…". Here is how I clean up share memory segments:

ipcs -s | gawk '{ print $2 }' | grep -P '\d' | xargs -n 1 ipcrm -s

What is an MPM?

MPM stand for Multi-Processing Modules. It is a modular design / API that allow apache to be easily ported to a wide variety of platforms in a range of different environments. Different platforms and different environments often require different features, or may have different ways of implementing the same feature most efficiently. This design allows the webmaster to choose which features to be included in the server by selecting which modules to load either at compile-time or at run-time.

At the user level, MPMs appear much like other modules. The main difference is that one and only one MPM can be loaded into the server at any time. MPMs must be chosen during configuration, and compiled into the server. Compilers are capable of optimizing a lot of functions if threads are used, but only if they know that threads are being used. Different distribution (operating system) may provide different binaries for different mpm. For example, RedHat ES4 or Fedora Core 4 provide /usr/sbin/httpd.worker for the worker (threaded) mpm, and /usr/sbin/httpd for the prefork mpm.

How do I know which mpm is currently used?

From command line, you can specify -l option to either /usr/sbin/httpd or apachectl. From inside your code, you can call ap_mpm_query()

How can we build the debuginfo rpm

In order to build the debuginfo rpm for a particular rpm package, the src rpm of the respective package needs to be obtained. In this example, we will build the debuginfo rpm for httpd package.

up2date -d httpd --src --get (see the up2date man page) 
cd /var/spool/up2date 
rpm -i  *.src.rpm (and install any dependent packages if necessary) 
rpmbuild -bb /usr/src/redhat/SPECS/httpd.spec (This re-build the packages) 
cd /usr/src/redhatRPMS/i386 (the debuginfo rpm should be here)

What are other web servers?

What are some load balancing software?

  • mod_proxy
  • perlbal

What are some tools for load testing?

What is the purpose of the MM library?

The MM library is optional. It is used for shared memory support in Apache/EAPI. This allows mod_ssl to use high performance RAM-based session instead of disk-base one.

How can we install Apache from source?

mkdir /usr/src/apache
cp apache_1.3.x.tar.gz /usr/src/apache
cp mod_ssl_2.6.x-1.3.x.tar.gz /usr/src/apache
cp openssl_0.9.x.tar.gz /usr/src/apache
cp mm_1.1.x.tar.gz /usr/src/apache

cd /usr/src/apache
tar -xvzf apache_1.3.x.tar.gz
tar -xvzf openssl_0.9.x.tar.gz

cd openssl-0.9.x
./configure
make
make test
make install

cd ..
cd mm-1.1.x
./configure --disable-shared
make

cd ..
tar -xvzf mod_sql-2.6.x_1.3.x.tar.gz
cd mod_ssl-2.6.x-1.3.x
./configure --with-apache=../apache_1.3.x

cd ..
[ ... Add more modules to Apache source tree ...]

tar -xvzf mod_perl-1.xx.tar.gz
cd mod_perl-1.xx
perl Makefile.PL \
    EVERYTHING=1 \
    APACHE_SRC=../apache_1.3.x/src \
    USE_APACI=1 \
    PREP_HTTPD=1 \
    DO_HTTPD=1
make
make install // This will install only the Perl portion

cd ..
cd apache_1.3.x
SSL_BASE=/usr/local/ssl
EAPI_MM=../mm-1.1.x
./configure \
    --with-mm=../mm-1.1.x \
    --prefix=/usr/local/apache \
    --enable-module=ssl \
    --activate-module=src/modules/perl/libperl.a \
    --enable-module=perl \
    --enable-shared=ssl \ # build mod_ssl as a DSO
    --enable-shared=perl \
    --enable-module=rewrite \
    --enable-shared=rewrite

make
make certificate
make install

cd ..
/usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl startssl

How can we install mod_auth_mysql as a DSO?

tar -xvzf mod_auth_mysql...
cd mod_auth_mysql...
cp config.h auth_mysql_config.h
/usr/local/apache/bin/apxs -i -a -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient -c mod_auth_mysql.c

How can we install mod_fastcgi as a DSO?

unpack the source
change to the mod_fastcgi source directory
/usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so

How can we install mod_php as a DSO from source?

unpack the source tar file for PHP
change to PHP source directory
./configure \
    --with-apxs=/usr/local/apache/bin/apxs \
    --with-gd \
    --with-imap \
    --with-mysql=/usr/local/mysql \
    --with-ldap=/usr/local \
    --with-zlib \
    --enable-track-vars
make
make install

How can we install mod_perl as a DSO from source?

unpack
change to source directory
perl Makefile.PL \
    USE_APXS=1 \
    WITH_APXS=/usr/local/apache/bin/apxs \
    EVERYTHING=1
make
make install

How can we password protect a directory?

1. Create .htaccess file that look like this:

AuthUserFile    /usr/www/dirname/.htpasswd
AuthGroupFile    /dev/null
AuthName    "The Secret Page"
AuthType Basic

<Limit GET POST>
    require valid_user
</Limit>

2. Create the .htpasswd file:

htpasswd -c .htpasswd user_name

3. Continue to add new users without the -c option:

htpasswd .htpasswd new_user_name

Look into using htdigest.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License