Apache Configuration (Ubuntu 18.04 Bionic Beaver)

Enable the below

/usr/sbin/a2enmod headers rewrite socache_shmcb

/etc/apache2/apache2.conf

Original vs Modified (Original < and Modified >)

175a176,181
> <Directory /data/www/>
>       Options Indexes FollowSymLinks
>       AllowOverride None
>       Require all granted
> </Directory>
>
213a220
> LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" proxycomb
216a224,227
> LogFormat "%h %t %>s %B %D %k" performance
> LogFormat "%{X-Forwarded-For}i %t %>s %B %D %k" proxyperf
>
> SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
222c233,234
< IncludeOptional conf-enabled/*.conf
---
> #IncludeOptional conf-enabled/*.conf
> Include conf-enabled/
225c237,238
< IncludeOptional sites-enabled/*.conf
---
> #IncludeOptional sites-enabled/*.conf
> Include sites-enabled/

/etc/apache2/ports.conf

No differences

/etc/apache2/conf-available/httpd.conf

Create New file /etc/apache2/conf-available/httpd.conf

ServerName localhost
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    AuthType basic
    AuthName "Apache status"
    AuthUserFile /etc/apache2/conf-available/serverstatus.htpasswd
    Require valid-user
    Order deny,allow
    Deny from all
    Allow from 192.168.1.1/24
</Location>

Link this file to conf-enabled directory

cd /etc/apache2/conf-enabled
ln -s ../conf-available/httpd.conf httpd.conf
htpasswd -c serverstatus.htpasswd <username>

/etc/apache2/mods-available & mods-enabled

You can ignore differences here.

/etc/apache2/sites-available

No changes to:

  • 000-default.conf &
  • default-ssl.conf

Note: Custom configuration that I have. Add these to directories: domaintemplate & localdomain


Ref: Old Configuration


QR Code
QR Code tech:linux:apache_configuration (generated for current page)