If you see 'Directory index forbidden by Options directive: ' error in Apache error_log file, it's most likely that you do not have the default 'index.html' page on the directory you are trying to access. To fix this, either enter the page name you want to access (such as http://myhost/somedir/index.php) or add that page name to the DirectoryIndex directive in Apache 'httpd.conf' file.
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Filed under: apache | |Comments off
Setup mod_rewrite
Edit httpd.conf and
* Uncomment line:
LoadModule rewrite_module modules/mod_rewrite.so
* Add:
<IfModule rewrite_module>
RewriteEngine On # turn on rewrite engine
RewriteLog c:/temp/rewrite.log # turn on logging
RewriteLogLevel 9 # set log level
RewriteRule ^/test(.*) http://www.google.com/ [P]
</IfModule>
Setup mod_proxy
Edit httpd.conf and uncomment line:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
References
http://www.apachetutor.org/admin/reverseproxies
Filed under: apache | |Comments off
Dependencies
* Make sure following packages are installed: bison flex gcc db4 db4-devel libxml2-devel libpng-devel. Installed if not already with
yum install bison flex gcc db4 db4-devel libxml2-devel libpng-devel
Install Apache 2
wget http://www.gossipcheck.com/mirrors/apache/httpd/httpd-2.2.14.tar.gz
tar xvxf httpd-2.2.14.tar.gz
cd httpd-2.2.14
./configure \
--enable-so \
--enable-rewrite=shared \
--enable-headers \
--enable-proxy \
--enable-proxy-balancer \
--enable-proxy-connect \
--enable-proxy-http \
--enable-rewrite \
--enable-ssl
make
make install
# Start/Stop
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
Auto Start Apache 2
* cp /usr/local/apache2/bin/apachectl /etc/init.d
* chmod 755 /etc/init.d/apachectl
* Add to /etc/init.d/apachectl right below #!/bin/sh with comments on
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/logs/httpd.pid
# config: /usr/local/apache/conf/httpd.conf
#
* /sbin/chkconfig --add apachectl
* /sbin/chkconfig --level 35 apachectl on
Install MySql Shared Library
* Required for PHP --with-mysql configure option
Install PHP 5
* Build and Compile yourself
wget http://us2.php.net/get/php-5.3.0.tar.gz/from/us3.php.net/mirror
tar zxvf php-5.3.0.tar.gz
cd php-5.3.0
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-bcmath \
--with-pear \
--enable-sockets \
--with-zlib \
--with-gd \
--with-freetype
make
make install
cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/apache2/conf/httpd.conf
AddHandler application/x-httpd-php .php .phtml .php3 .php4
# Not sure why we need to do this
chcon -t texrel_shlib_t /usr/local/apache/modules/libphp5.so
/usr/local/apache2/bin/apachectl start
* Use RPM Source Package
wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/php-5.1.6-23.2.el5_3.src.rpm
rpm --rebuild php-5.1.6-23.2.el5_3.src.rpm
cd /usr/src/redhat/RPM/
rpm -iv php-5.1.6-23.2.el5_3.rpm
Filed under: Linux, apache | |Comments off
Configuration
Edit httpd.conf
LoadModule ssl_module modules/mod_ssl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Listen 443
NameVirtualHost *:443
<VirtualHost *:443>
ServerName http://localhost
# Serving https
SSLEngine on
SSLCertificateFile C:/certs/localhost.cer
SSLCertificateKeyFile C:/localhost.key
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine on
SSLProxyCACertificateFile "C:/certs/cacert.pem"
# Need BOTH public key AND unencrypted private key:
SSLProxyMachineCertificateFile "C:/certs/localhost_privatekey_publickey.txt"
SSLProxyVerifyDepth 10
SSLProxyVerify none
# Proxy to app1.my.com:8080
ProxyPass /app1/ https://app1.my.com:8080/
ProxyPassReverse /app1/ https://app1.my.com:8080/
</VirtualHost>
Troubleshooting
incomplete client cert configured for SSL proxy (missing or encrypted private key?)
* Need BOTH public key AND unencrypted private key pasted together
SSLProxyMachineCertificateFile "C:/certs/localhost_privatekey_publickey.txt"
Filed under: apache, ssl | |Comments off