Apache

Apache2 is already installed when you choose the LAMP server on Ubuntu installation.

Addition necessary apache modules:

grep www-data /etc/passwd >>/usr/local/chroot.web/etc/passwd
grep www-data /etc/group >>/usr/local/chroot.web/etc/group

/etc/apache2/apache2.conf

ChrootDir /var/www

Timeout 20
KeepAliveTimeout 4

<IfModule mpm_prefork_module>
    StartServers         40
    MinSpareServers      40
    MaxSpareServers      80
    MaxClients          160
    MaxRequestsPerChild   5000
</IfModule>

DefaultType text/html

LogFormat "%v %h %l %u %t \"%r %P %T\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_virtual

ServerTokens Prod

ServerSignature Off

/etc/apache2/envvars

export APACHE_PID_FILE=/var/run/apache2/apache2.pid
export LANG=hu_HU.UTF-8
export LC_ALL=hu_HU.UTF-8

/etc/apache2/ports.conf

Listen 127.0.0.1:80
Listen 127.0.0.1:443

/etc/apache2/httpd.conf

ServerAdmin webmaster@server_name

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

CustomLog /var/log/apache2/access.log combined_virtual

LimitInternalRecursion 4

# ModSecurity: SecDataDir not allowed in VirtualHost.
SecDataDir /sec_data

SetEnvIf Request_URI \.jpg nolog-request
SetEnvIf Request_URI \.jpeg nolog-request
SetEnvIf Request_URI \.gif nolog-request
SetEnvIf Request_URI \.png nolog-request
SetEnvIf Request_URI \.css nolog-request
SetEnvIf Request_URI \.js nolog-request

/etc/apache2/conf.d/charset

AddDefaultCharset UTF-8


/etc/apache2/mods-enabled

  • auth_basic
  • authz_default
  • authz_host
  • dir
  • geoip
  • mime
  • mod_chroot
  • mod-security2
  • php5
  • rewrite
  • rpaf
  • setenvif
  • unique_id


/etc/apache2/mods-enabled/mime

#AddType application/x-compress .Z
#AddType application/x-gzip .gz .tgz
#AddType application/x-bzip2 .bz2

#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

#AddCharset us-ascii    .ascii .us-ascii
#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  .cyr .iso-ru
#AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
#AddCharset ISO-8859-7  .iso8859-7  .grk .greek
#AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
#AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
#AddCharset ISO-8859-10  .iso8859-10  .latin6
#AddCharset ISO-8859-13  .iso8859-13
#AddCharset ISO-8859-14  .iso8859-14  .latin8
#AddCharset ISO-8859-15  .iso8859-15  .latin9
#AddCharset ISO-8859-16  .iso8859-16  .latin10
#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 .b5
#AddCharset cn-Big5     .cn-big5
#AddCharset WINDOWS-1251 .cp-1251   .win-1251
#AddCharset CP866       .cp866
#AddCharset KOI8      .koi8
#AddCharset KOI8-E      .koi8-e
#AddCharset KOI8-r      .koi8-r .koi8-ru
#AddCharset KOI8-U      .koi8-u
#AddCharset KOI8-ru     .koi8-uk .ua
#AddCharset ISO-10646-UCS-2 .ucs2
#AddCharset ISO-10646-UCS-4 .ucs4
#AddCharset UTF-7       .utf7
AddCharset UTF-8       .utf8
#AddCharset UTF-16      .utf16
#AddCharset UTF-16BE    .utf16be
#AddCharset UTF-16LE    .utf16le
#AddCharset UTF-32      .utf32
#AddCharset UTF-32BE    .utf32be
#AddCharset UTF-32LE    .utf32le
#AddCharset euc-cn      .euc-cn
#AddCharset euc-gb      .euc-gb
#AddCharset euc-jp      .euc-jp
#AddCharset euc-kr      .euc-kr
#AddCharset EUC-TW      .euc-tw
#AddCharset gb2312      .gb2312 .gb
#AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
#AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
#AddCharset shift_jis   .shift_jis .sjis

#AddHandler type-map var

#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml

/etc/apache2/mods-enabled/php5.conf

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php
</IfModule>
touch /var/www/var/log/php.log /var/www/var/log/php_ssl.log
chown www-data:www-data /var/www/var/log/php.log /var/www/var/log/php_ssl.log

ln -s /var/www/var/run/apache2/apache2.pid /var/run/apache2/apache2.pid
ln -s /var/www/usr/share/GeoIP/GeoIP.dat /usr/share/GeoIP/GeoIP.dat

ln -s /var/www/var/DocRoot/ /var/DocRoot

/etc/apache2/sites-available/default:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    DocumentRoot /var/DocRoot/localhost
    DirectoryIndex index.html index.php
    CustomLog /var/log/apache2/access.log combined_virtual
    ErrorLog /var/log/apache2/error.log
    Include /etc/apache2/modsecurity/*.conf
    php_admin_value open_basedir /var/DocRoot/localhost/
</VirtualHost>

/etc/apache2/sites-available/default_ssl:

NameVirtualHost 127.0.0.1:443

<VirtualHost 127.0.0.1:443>
    DocumentRoot /var/DocRoot/localhost
    DirectoryIndex index.html index.php
    CustomLog /var/log/apache2/ssl.log combined_virtual
    ErrorLog /var/log/apache2/ssl_error.log

    <FilesMatch "^.*(|.php|.html|.htm)$">
        GeoIPEnable On
        GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
        GeoIPOutput Env
        SetEnvIf GEOIP_COUNTRY_CODE HU OK_Country
        Order Deny,Allow
        Deny from all
        Allow from env=OK_Country
    </FilesMatch>

    php_admin_value open_basedir /var/DocRoot/localhost/
    php_value error_log /var/log/ssl_php.log
</VirtualHost>

You need some links from /etc/apache2/sites-available to /etc/apache2/sites-enabled.

ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/000-default
ln -s /etc/apache2/sites-available/default_ssl /etc/apache2/sites-enabled/000-default_ssl

/usr/sbin/apache2ctl

mkdir -p /var/run/apache2
ln -f -s /var/www/var/run/apache2/apache2.pid /var/run/apache2/apache2.pid



http://httpd.apache.org/
https://help.ubuntu.com/8.04/serverguide/C/httpd.html

 
Logged in as: Oszkár Kmetti
web/apache.txt · Last modified: 2009.03.31 11:45 by oszi
 
Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki