The Apache HTTP Server Project is a collaborative software development effort aimed at creating a robust, commercial-grade, featureful, and freely-available source code implementation of an HTTP (Web) server. The project is jointly managed by a group of volunteers located around the world, using the Internet and the Web to communicate, plan, and develop the server and its related documentation. This project is part of the Apache Software Foundation. In addition, hundreds of users have contributed ideas, code, and documentation to the project. This file is intended to briefly describe the history of the Apache HTTP Server and recognize the many contributors. PostgreSQL, the highly scalable, SQL compliant, open source object-relational database management system.
The Apache web site carries details on the latest release and other information to make your work or play with PostgreSQL more productive. And The mailing lists are a good place to have your questions answered, to share experiences with other users, and to contact the developers.
Download and save Apache source archive from http://httpd.apache.org We use mod_deflate to support HTTP gzip compression. And mod_mem_cache to support caching of file descriptors.
cd /usr/local/src md5sum -cv httpd-2.XX.YY.tar.gz.md5 #md5sum must be print OK http-2.XX.YY.tar.gz OK rm http-2.XX.YY.tar.gz cd http-2.XX.YY
For Java Front Server use MPM worker :
./configure --prefix=/usr/local/apache-2.2.3 --with-mpm=worker --enable-ssl --enable-rewrite --enable-usertrack --enable-proxy --enable-deflate --enable-cache --enable-mem-cache --disable-userdir
For PHP Front Server use MPM pre-fork (PHP doesn't support worker) :
./configure --prefix=/usr/local/apache-2.2.3 --with-mpm=prefork --enable-ssl --enable-rewrite --enable-usertrack --enable-proxy --enable-deflate --enable-cache --enable-mem-cache --disable-userdir
Compile and install :
make make install
Install binaries and create required user and directories.
ln -s /usr/local/apache-2.XX.YY /usr/local/apache mkdir /var/log/apache mkdir /etc/apache mv /usr/local/apache/conf /etc/apache/ ln -s /etc/apache/conf /usr/local/apache/conf mkdir -p /usr/lib/apache mv /usr/local/apache/modules /usr/lib/apache ln -s /usr/lib/apache/modules /usr/local/apache/modules groupadd -g 2100 wwwgroup useradd -d /srv/www -g wwwgroup -u 2101 -m -s /bin/true apache
Edit and replace token in /etc/apache/conf/httpd.conf
ServerRoot "/usr/local/apache"
PidFile logs/httpd.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 2
ServerLimit 512
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 400
MaxRequestsPerChild 5000
</IfModule>
<IfModule worker.c>
StartServers 20
MaxClients 100
ThreadsPerChild 5
MinSpareThreads 25
MaxSpareThreads 75
MaxRequestsPerChild 1000
</IfModule>
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>
Listen 80
User apache
Group wwwgroup
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
ServerAdmin <support-unix@example.com>
ServerName <dummy-host.example.com>
UseCanonicalName Off
DocumentRoot /srv/XX/YY/dummy-host.example.com/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
DirectoryIndex index.html index.htm
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog "|/usr/bin/cronolog /var/log/apache/%Y%m%d-error_log"
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{cookie}i\"" leroymerlin
CustomLog "|/usr/bin/cronolog /var/log/apache/%Y%m%d-access_log" combined
ServerTokens Prod
ServerSignature Off
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
ForceLanguagePriority Prefer Fallback
AddDefaultCharset UTF-8
AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8 .utf8
AddCharset GB2312 .gb2312 .gb
AddCharset utf-7 .utf7
AddCharset utf-8 .utf8
AddCharset big5 .big5 .b5
AddCharset EUC-TW .euc-tw
AddCharset EUC-JP .euc-jp
AddCharset EUC-KR .euc-kr
AddCharset shift_jis .sjis
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler type-map var
AddOutputFilterByType DEFLATE text/html text/plain text/xml
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully
ExtendedStatus On
<Location /sstatuss>
Order deny,allow
Allow from 127.0.0.1
#Allow from 192.168.0.0
#Allow from all
SetHandler server-status
</Location>
Alias /css-status /var/run/css/status
#NameVirtualHost *:80
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /srv/XX/YY/dummy-host.example.com/www
# ServerName dummy-host.example.com
# ServerAlias dummy2-host.example.com
#
# ErrorLog "|/usr/bin/cronolog /var/log/apache/dummy-host.example.com/%Y%m%d-error_log"
# CustomLog "|/usr/bin/cronolog /var/log/apache/dummy-host.example.com/%Y%m%d-access_log"
#
# #Fix for Apache bug 39499
# SetEnv force-proxy-request-1.0 1
# SetEnv proxy-nokeepalive 1
#</VirtualHost>
Edit default startup script /etc/init.d/apache file.
#! /bin/sh
#
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/apache/bin/apachectl
NAME=httpd
DESC="Apache"
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
$DAEMON start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
$DAEMON stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
$DAEMON graceful
echo "done."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
$DAEMON restart
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0Add execution right and register automatic startup.
chmod a+x /etc/init.d/apache update-rc.d -f apache defaults
Same as installation section.
Upgrade old version to the new version.
/etc/init.d/apache stop rm /usr/local/apache ln -s /usr/local/apache-2.XX.ZZ /usr/local/apache cp -r /etc/apache/conf /etc/apache/conf.YYYYMMDD rm -rf /usr/local/apache/conf rm -rf /usr/local/apache/modules ln -s /etc/apache/conf /usr/local/apache/conf ln -s /usr/lib/apache/modules /usr/local/apache/modules /etc/init.d/apache start
Download and save Apache mod_jk source archive from http://tomcat.apache.org/connectors-doc/
cd /usr/local/src tar -xzf tomcat-connectors-1.2.XX-src.tar.gz cd tomcat-connectors-1-2.XX-src cd native ./configure --with-apxs=/usr/local/apache/bin/apxs make cd apache2.0
Register on Apache conf in /etc/apache/conf/httpd.conf
/usr/local/apache/bin/apxs -n jk -ia mod_jk.so
Edit and add lines in /etc/apache/conf/httpd.conf
<VirtualHost *:80> ... #register tomcat web application JkMount /manager/* worker1 ... </VirtualHost> # Where to find workers.properties JkWorkersFile /etc/apache/conf/workers.properties # Where to put jk logs JkLogFile /var/log/apache/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel error # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T"
Edit /etc/apache/conf/workers.properties file.
workers.tomcat_home=/usr/local/tomcat workers.java_home=/usr/local/java ps=/ worker.list=worker1 worker.worker1.port=8009 worker.worker1.host=localhost worker.worker1.type=ajp13
Download and save PHP source archive from http://php.net
cd /usr/local/src md5sum php-X.Y.Z.tar.gz #md5sum must be same as website rm php-X.Y.Z.tar.gz cd php-X.Y.Z ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc/php/apache --enable-ftp --with-mysql --with-zlib --with-gd --with-freetype-dir=/usr/lib --enable-gd-native-ttf --enable-mbstring=all make make install cp php.ini-dist /etc/php/apache/php.ini mkdir -p /usr/lib/phpX/modules
Edit and modify PHP configuration file /etc/php/apache/php.ini
register_globals = On ;Puis, modifier extension_dir par : extension_dir = "/usr/lib/phpX/modules" ;Modifier mysql.default_socket par : mysql.default_socket = /var/run/mysqld/mysqld.sock
Register PHP in Apache configuration file /etc/apache/conf/httpd.conf
#Ajouter la ligne suivante parmis les AddType AddType application/x-httpd-php .php #Ajouter index.php à la liste des DirectoryIndex DirectoryIndex index.html index.html.var index.php
Restart Apache
/etc/init.d/apache restart
You can test PHP environment with simple PHP page and this content :
<? phpinfo(); ?>
APC is an extension of Zend PHP engine. It's executable cache, PHP page is not re-interpreted at each call. This feature will be integrate to PHP version 6.
cd /usr/local/src wget http://pecl.php.net/get/APC-X.X.X.tgz tar xzf APC-X.X.X.tgz rm xzf APC-X.X.X.tgz cd APC-X.X.X /usr/local/bin/phpize ./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/local/apache/bin/apxs --with-php-config=/usr/local/bin/php-config make make install cp modules/apc.so /usr/lib/php5/modules
Register APC extension in PHP configuration file: /etc/php/apache/php.ini
;Zend extensions ... extension=apc.so extension=apc.so apc.enabled=1 apc.shm_segments=1 apc.optimization=0 apc.shm_size=128 apc.ttl=7200 apc.user_ttl=7200 apc.num_files_hint=1024 apc.mmap_file_mask=/var/tmp/apc/apc.XXXXXX apc.enable_cli=1
Create directory used by APC MMap algorithm.
mkdir /var/tmp/apc chmod 0777 /var/tmp/apc
Restart Apache
/etc/init.d/apache restartYou can test PHP environment with simple PHP page and this content :
<? phpinfo(); ?>