Apache Server linux installations

Here are the linux installation steps to apache 2.2 versions

# yum install gcc
#wget httpd version.tar.gz
#tar –xvzf  httpd version.tar.gz
#cd httpd version
#make clean
#make install
Default location for 2.2.0 is /etc/httpd
Creating directories conf conf.d logs modules run
Conf > httpd.conf
Conf.d > ssl.conf , welcome.conf
Logs > access_log, error_log ,ssl_access_log , ssl_error_log,ssl_request_log
Edit conf /httpd.conf
ServerRoot “/etc/httpd”

PidFile run/httpd.pid

Listen 80

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule auth_ldap_module modules/mod_auth_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so

Include conf.d/*.conf

User apache
Group apache

DocumentRoot “/var/www/html”

[root@domU-12-31-34-00-04-04 bin]# ./apachectl -k start or httpd –k start
#netstat -na inet Listen
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address State
tcp        0      0        *       LISTEN
tcp        0      0     *       LISTEN
tcp        0      0        *       LISTEN
tcp        0    696  ESTABLISHED
udp        0      0     *
udp        0      0        *

While configuring enable ssl
./configure enable=mod-ssl
Then go to conf.d /edit ssl.conf
LoadModule ssl_module modules/mod_ssl.so

Listen 443

SSLEngine on

SSLCertificateFile /etc/pki/tls/private/server.crt

SSLCertificateKeyFile /etc/pki/tls/private/server.key

ENABLING WEB STATUS (type http://server/server-status)
Check mod tsatus is enabled in httpd.conf file
LoadModule status_module modules/mod_status.so

ExtendedStatus On

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from all

Apache Server Status for domu.usma2.compute.amazonaws.com
Server Version: Apache/2.0.54 (Fedora)
Server Built: Jul 26 2006 11:00:19
Current Time: Thursday, 03-May-2007 02:43:28 EDT
Restart Time: Thursday, 03-May-2007 02:34:58 EDT
Parent Server Generation: 0
Server uptime: 8 minutes 29 seconds
Total accesses: 14 – Total Traffic: 62 kB
CPU Usage: u0 s.01 cu0 cs0 – .00196% CPU load
.0275 requests/sec – 124 B/second – 4534 B/request
1 requests currently being processed, 7 idle workers

Srv    Child Server number – generation
PID    OS process ID
Acc    Number of accesses this connection / this child / this slot
M    Mode of operation
CPU    CPU usage, number of seconds
SS    Seconds since beginning of most recent request
Req    Milliseconds required to process most recent request
Conn    Kilobytes transferred this connection
Child    Megabytes transferred this child
Slot    Total megabytes transferred this slot
SSL/TLS Session Cache Status:
cache type: SHMCB, shared memory: 512000 bytes, current sessions: 0
sub-caches: 32, indexes per sub-cache: 133
index usage: 0%, cache usage: 0%
total sessions stored since starting: 0
total sessions expired since starting: 0
total (pre-expiry) sessions scrolled out of the cache: 0
total retrieves since starting: 0 hit, 0 miss
total removes since starting: 0 hit, 0 miss


#wget -o httpd-2.2.4.tar.gz
#tar –xvzf  httpd-2.2.4.tar.gz
#cd  httpd-2.2.4

[root@domU-12-31-34-00-04-04 httpd-2.2.4]# ./configure –help
`configure’ configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]… [VAR=VALUE]…

To assign environment variables (e.g., CC, CFLAGS…), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

-h, –help              display this help and exit
–help=short        display options specific to this package
–help=recursive    display the short help of all the included packages
-V, –version           display version information and exit
-q, –quiet, –silent   do not print `checking…’ messages
–cache-file=FILE   cache test results in FILE [disabled]
-C, –config-cache      alias for `–cache-file=config.cache’
-n, –no-create         do not create output files
–srcdir=DIR        find the sources in DIR [configure dir or `..’]

Installation directories:
–prefix=PREFIX         install architecture-independent files in PREFIX
–exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX

By default, `make install’ will install all the files in
`/usr/local/apache2/bin’, `/usr/local/apache2/lib’ etc.  You can specify
an installation prefix other than `/usr/local/apache2′ using `–prefix’,
for instance `–prefix=$HOME’.

For better control, use the options below.

Fine tuning of the installation directories:
–bindir=DIR           user executables [EPREFIX/bin]
–sbindir=DIR          system admin executables [EPREFIX/sbin]
–libexecdir=DIR       program executables [EPREFIX/libexec]
–datadir=DIR          read-only architecture-independent data [PREFIX/share]
–sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
–sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
–localstatedir=DIR    modifiable single-machine data [PREFIX/var]
–libdir=DIR           object code libraries [EPREFIX/lib]
–includedir=DIR       C header files [PREFIX/include]
–oldincludedir=DIR    C header files for non-gcc [/usr/include]
–infodir=DIR          info documentation [PREFIX/info]
–mandir=DIR           man documentation [PREFIX/man]

System types:
–build=BUILD     configure for building on BUILD [guessed]
–host=HOST       cross-compile to build programs to run on HOST [BUILD]
–target=TARGET   configure for building compilers for TARGET [HOST]

Optional Features:
–disable-FEATURE       do not include FEATURE (same as –enable-FEATURE=no)
–enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
–enable-v4-mapped      Allow IPv6 sockets to handle IPv4 connections
–enable-exception-hook Enable fatal exception hook
Turn on debugging and compile time warnings
–enable-pie            Build httpd as a Position Independent Executable
Space-separated list of modules to enable | “all” |
Space-separated list of shared modules to enable |
“all” | “most”
–disable-authn-file    file-based authentication control
–enable-authn-dbm      DBM-based authentication control
–enable-authn-anon     anonymous user authentication control
–enable-authn-dbd      SQL-based authentication control
–disable-authn-default authentication backstopper
–enable-authn-alias    auth provider alias
–disable-authz-host    host-based authorization control
‘require group’ authorization control
–disable-authz-user    ‘require user’ authorization control
–enable-authz-dbm      DBM-based authorization control
–enable-authz-owner    ‘require file-owner’ authorization control
–enable-authnz-ldap    LDAP based authentication
–disable-authz-default authorization control backstopper
–disable-auth-basic    basic authentication
–enable-auth-digest    RFC2617 Digest authentication
–enable-isapi          isapi extension support
–enable-file-cache     File cache
–enable-cache          dynamic file caching
–enable-disk-cache     disk caching module
–enable-mem-cache      memory caching module
–enable-dbd            Apache DBD Framework
–enable-bucketeer      buckets manipulation filter
–enable-dumpio         I/O dump filter
–enable-echo           ECHO server
–enable-example        example and demo module
–enable-case-filter    example uppercase conversion filter
–enable-case-filter-in example uppercase conversion input filter
–enable-ext-filter     external filter module
–disable-include       Server Side Includes
–disable-filter        Smart Filtering
–disable-charset-lite  character set translation
–enable-charset-lite   character set translation
–enable-deflate        Deflate transfer encoding support
–enable-ldap           LDAP caching and connection pooling services
–disable-log-config    logging configuration
–enable-log-forensic   forensic logging
–enable-logio          input and output logging
–disable-env           clearing/setting of ENV vars
–enable-mime-magic     automagically determining MIME type
–enable-cern-meta      CERN-type meta files
–enable-expires        Expires header control
–enable-headers        HTTP header control
–enable-ident          RFC 1413 identity check
–enable-usertrack      user-session tracking
–enable-unique-id      per-request unique ids
–disable-setenvif      basing ENV vars on headers
–enable-version        determining httpd version in config files
–enable-proxy          Apache proxy module
–enable-proxy-connect  Apache proxy CONNECT module
–enable-proxy-ftp      Apache proxy FTP module
–enable-proxy-http     Apache proxy HTTP module
–enable-proxy-ajp      Apache proxy AJP module
–enable-proxy-balancer Apache proxy BALANCER module
–enable-ssl            SSL/TLS support (mod_ssl)
–enable-distcache      Select distcache support in mod_ssl
example optional hook exporter
example optional hook importer
example optional function importer
example optional function exporter
–enable-static-support Build a statically linked version of the support
Build a statically linked version of htpasswd
Build a statically linked version of htdigest
Build a statically linked version of rotatelogs
Build a statically linked version of logresolve
–enable-static-htdbm   Build a statically linked version of htdbm
–enable-static-ab      Build a statically linked version of ab
Build a statically linked version of checkgid
Build a statically linked version of htcacheclean
Build a statically linked version of httxt2dbm
–enable-http           HTTP protocol handling
–disable-mime          mapping of file-extension to MIME
–enable-dav            WebDAV protocol handling
–disable-status        process/thread monitoring
–disable-autoindex     directory listing
–disable-asis          as-is filetypes
–enable-info           server information
–enable-suexec         set uid and gid for spawned processes
–disable-cgid          CGI scripts
–enable-cgi            CGI scripts
–disable-cgi           CGI scripts
–enable-cgid           CGI scripts
–enable-dav-fs         DAV provider for the filesystem
–enable-dav-lock       DAV provider for generic locking
–enable-vhost-alias    mass virtual hosting module
–disable-negotiation   content negotiation
–disable-dir           directory request handling
–enable-imagemap       server-side imagemaps
–disable-actions       Action triggering on requests
–enable-speling        correct common URL misspellings
–disable-userdir       mapping of requests to user-specific directories
–disable-alias         mapping of requests to different filesystem parts
–enable-rewrite        rule based URL manipulation
–enable-so             DSO capability

Optional Packages:
–with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
–without-PACKAGE       do not use PACKAGE (same as –with-PACKAGE=no)
–with-included-apr     Use bundled copies of APR/APR-Util
–with-apr=PATH         prefix for installed APR, path to APR build tree,
or the full path to apr-config
–with-apr-util=PATH    prefix for installed APU, path to APU build tree,
or the full path to apu-config
–with-pcre=PATH        Use external PCRE library
–with-port=PORT        Port on which to listen (default is 80)
–with-z=DIR            use a specific zlib library
–with-sslc=DIR         RSA SSL-C SSL/TLS toolkit
–with-ssl=DIR          OpenSSL SSL/TLS toolkit
–with-mpm=MPM          Choose the process model for Apache to use.
Enable module-file in the modules/<module-type>
–with-program-name     alternate executable name
–with-suexec-bin       Path to suexec binary
–with-suexec-caller    User allowed to call SuExec
–with-suexec-userdir   User subdirectory
–with-suexec-docroot   SuExec root directory
–with-suexec-uidmin    Minimal allowed UID
–with-suexec-gidmin    Minimal allowed GID
–with-suexec-logfile   Set the logfile
–with-suexec-safepath  Set the safepath
–with-suexec-umask     umask for suexec’d process

Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP         C preprocessor

Use these variables to override the choices made by `configure’ or to help
it to find libraries and programs with nonstandard names/locations.
#make clean
#make install
Check the compiled modules
# httpd -l
Compiled in modules:
core.c     ,  prefork.c ,      http_core.c,      mod_so.c
Default directory will be /usr/local/apache2
bin    cgi-bin  error   icons    lib   man     modules
build  conf     htdocs  include  logs  manual
bin > b            apu-1-config  dbmmanage    htcacheclean  htpasswd   logresolve
apachectl     apxs          envvars      htdbm         httpd      rotatelogs
apr-1-config  checkgid      envvars-std  htdigest      httxt2dbm
lib > apr.exp      libapr-1.la    libapr-1.so.0.2.8  libexpat.a   libexpat.so.0
aprutil.exp  libapr-1.so    libaprutil-1.a     libexpat.la  libexpat.so.0.1.0
libapr-1.a   libapr-1.so.0  libaprutil-1.la    libexpat.so  pkgconfig
modules > httpd.exp
conf  > extra  httpd.conf  magic  mime.types  original
conf/extra > httpd-autoindex.conf  httpd-languages.conf           httpd-ssl.conf
httpd-dav.conf        httpd-manual.conf              httpd-userdir.conf
httpd-default.conf    httpd-mpm.conf                 httpd-vhosts.conf
httpd-info.conf       httpd-multilang-errordoc.conf
htdocs > apache_pb.gif  apache_pb22.gif  apache_pb22_ani.gif
apache_pb.png  apache_pb22.png  index.html
logs > access_log  error_log  httpd.pid
Edit httpd.conf file from conf
ServerRoot “/usr/local/apache2”

Listen 80
Listen 443

User daemon
Group daemon

DocumentRoot “/usr/local/apache2/htdocs”

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

ErrorLog logs/error_log

ScriptAlias /cgi-bin/ “/usr/local/apache2/cgi-bin/”
<Directory “/usr/local/apache2/cgi-bin”>
AllowOverride None
Options None
Order allow,deny
Allow from all

Include conf/extra/httpd-vhosts.conf
Edit vhost.conf from extra
NameVirtualHost *:443

<VirtualHost *:443>
ServerAdmin root@localhost.localhost.com
DocumentRoot /usr/local/apache2/htdocs
ServerName domU.usma2.compute.amazonaws.com
ErrorLog logs/error_log
CustomLog logs/access_log common
SSLEngine on
SSLCertificateFile /etc/pki/tls/private/server.crt
SSLCertificatekeyFile /etc/pki/tls/private/server.key
SSLSessionCache shmcb:/usr/local/apache2/logs/ssl_scache(512000)
SSLSessionCacheTimeout 300

Include conf/extra/httpd-ssl.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

Edit ssl.conf from extra
Listen 443
<VirtualHost _default_:443>
DocumentRoot “/usr/local/apache2/htdocs”
ServerName http://www.domU-12-31-34-00-04-04.com:443
ServerAdmin root@domU-12-31-34-00-04-04.com
ErrorLog /usr/local/apache2/logs/error_log
TransferLog /usr/local/apache2/logs/access_log
SSLEngine on
SSLCertificateFile /etc/pki/tls/private/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key


RedirectMatch permanent /  http://beta1.test.com/xyz

Service restarts from command
Starting/stopping/restarting apache  ./apachectl –k start/stop/restart
Or  httpd –k start/stop/restart


Posted on July 12, 2011, in LInux Based, Uncategorized, Web. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: