License

Copyright (C) 2008-2021 Oliver Bohlen.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

A copy of the license is included in the section entitled "GNU Free Documentation License".

Introduction

This documentation comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

Howto: Webserver for Gentoo Linux

I use name based virtual hosts for multiple domains under the same IP. Here is my Webserver and PHP configuration.
Before installing (emergeing) apache, change the /etc/make.conf as shown below.

If you want to use this solution you need the following howto(s) finished:

Required software

The required software has to be installed with the following command(s):
emerge www-servers/apache

Changes in /etc/apache2/modules.d/00_mod_log_config.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/apache2/modules.d/00_mod_log_config.conf

Changed on 13.01.09
Issued by olli
Beginning line 24

This activates apache logging for with vhost names in the log file


Before change
CustomLog /var/log/apache2/access_log common
After change
CustomLog /var/log/apache2/access_log vhost

Changes in /etc/apache2/vhosts.d/02_vhosts.conf

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/apache2/vhosts.d/02_vhosts.conf

Changed on 13.01.09
Issued by olli
Beginning line 1

Here are some settings for name based virtual hosts and some security settings before.


# ServerName
ServerName xgabosh.example.com

# Generate VHosts from Macro
Use VHost www.example.com
Use VHost fbofl.example.com
Use VHost drucker-ofl.example.com
Use VHost get.example.com
Use VHost doc.example.com
Use VHost gtc.example.com
Use VHost camofl.example.com
Use VHost epson.example.com
Use VHost status.example.com
Use VHost www.olmusic.de
Use VHost olmusic.example.com
Use VHost www.drachenrachen.de
Use VHost nextcloud.example.com
Use VHost nextcloud-test.example.com
Use VHost autoconfig.example.com
Use VHost vnc.example.com
Use VHost share.example.com
Use VHost media.example.com
Use VHost rss-bridge.example.com
Use VHost nextcloud-talk-signaling.example.com
Use VHost blog.example.com
Use VHost phpmyadmin.example.com
Use VHost shop.olmusic.de
Use VHost friendica.example.com

<Location /favicon.ico>
 Require all granted
</Location>

Changes in /etc/conf.d/apache2

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/conf.d/apache2

Changed on 09.09.08
Issued by olli
Beginning line 36

Apache startoptions for enabling PHP5 and SSL


Before change
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE"
After change
APACHE2_OPTS="-D DAV -D DAV_FS -D PHP -D SSL -D LANGUAGE -D PROXY -D MPM_ITK -D AUTHNZ_EXTERNAL"

Changes in /etc/php/gabosh-php.ini

File permissions:
Owner: root
Group: root
Permissions: -rw-r--r--

Click here for a download of the complete file: /etc/php/gabosh-php.ini

Changed on 23.02.11
Issued by olli
Beginning line 1

PHP-Configuration

; Don't log deprecated errors
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
; Don't display errors
display_errors = Off
display_startup_errors = Off
track_errors = Off
html_errors = Off
; Log errors to file
error_log = /var/log/apache2/php_errors.log
; Maximum post size of 20MB
post_max_size = 100M
; Maximum of 20MB upload
upload_max_filesize = 100M
; Default timezone for PHP
date.timezone = "Europe/Berlin"
; Maximum of 200 MySQL active connections at the same time
mysql.max_persistent = 200
; Maximum of 300 MySQL connections at the same time
mysql.max_links = 300
; Set max memory
memory_limit = 2048M
; INotify (pecl install inotify)
extension=inotify.so
; enable APC-Cache in CLI
apc.enable_cli=1
output_buffering = Off

Setting up services

For starting the new service after system reboot you should add it to a runlevel with the following command(s):

rc-update add apache2 

Please send a feedback to: doc<at>gabosh.net

Howto listing
File Index

Here you can find the official Gentoo Linux Forums where you can find a lot of answers.

Here a link to the official Gentoo Linux Homepage.

Edit Howto

About / Impressum

Click here for About / Impressum

Wishlist

If you want to support my work you can find my Amazon whishlist here