Der Apache HTTP Server ist ein Open Source Webserver und der seit 1996 am meisten im Internet eingesetzte Webserver weltweit. Der freie und quell offenen Webserver wird von der Apache Software Foundation zur Verfügung gestellt und weiterentwickelt.
Ab hier werden zur Ausführung nachfolgender Befehle root-Rechte benötigt. Um der Benutzer root zu werden, melden Sie sich bitte als root-Benutzer am System an, oder wechseln mit nachfolgendem Befehl zum Benutzer root:
Um einen Apache HTTP Server, welcher als Dienst/Daemon als Hintergrundprozess läuft, auch nach einem Neustart des Servers zur Verfügung zu haben, soll der Dienst/Daemon mit dem Server mit gestartet werden, was mit nachfolgendem Befehl realisiert werden kann:
systemctl enable httpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Eine Überprüfung, ob beim Neustart des Server der httpd-Dienst/Daemon wirklich mit gestartet wird, kann mit nachfolgendem Befehl erfolgen und sollte eine Anzeige, wie ebenfalls nachfolgend dargestellt ausgeben:
Damit der Apache HTTP Server auch erreichbar ist und nicht die Webseiten-Anfragen vom Paketfilter iptables blockiert werden, müssen nachfolgende Regeln zum iptables-Regelwerk hinzugefügt werden.
Um die aktuellen iptables-Regeln erweitern zu können, sollten diese erst einmal aufgelistet werden, was mit nachfolgendem Befehl durchgeführt werden kann:
Nachfolgende Befehle, fügen folgende iptables-Regeln dem iptables-Regelwerk nach der Position 4 hinzu, ohne das der Paketfilter angehalten werden muss:
Die neuen Zeilen sind an Position 5 (INPUT) und Position 6 (INPUT) zu sehen, hier nachfolgend zur Verdeutlichung noch einmal dargestellt (nur relevanter Ausschnitt):
Um diese iptables-Regel dauerhaft, auch nach einem Neustart des Server, weiterhin im iptables-Regelwerk zu speichern, muss nachfolgend dargestellter Befehl abschließend noch ausgeführt werden:
Nachfolgender Befehl kann dazu verwendet werden, um zu überprüfen, ob das iptables-Regelwerk auch korrekt gespeichert wurde:
# cat /etc/iptables/iptables.rules
# Generated by iptables-save v1.8.7 on Wed Mar 31 10:13:23 2022
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [13:3332]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -j LOG --log-prefix "REC-INP Defend " --log-level 5
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
COMMIT
# Completed on Wed Mar 31 10:13:23 2022
# Generated by iptables-save v1.8.7 on Wed Mar 31 10:13:23 2022
*nat
:PREROUTING ACCEPT [5:352]
:INPUT ACCEPT [1:60]
:OUTPUT ACCEPT [8:577]
:POSTROUTING ACCEPT [8:577]
COMMIT
# Completed on Wed Mar 31 10:13:23 2022
# Generated by iptables-save v1.8.7 on Wed Mar 31 10:13:23 2022
*mangle
:PREROUTING ACCEPT [1216:2104461]
:INPUT ACCEPT [1212:2104169]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [944:91396]
:POSTROUTING ACCEPT [944:91396]
COMMIT
# Completed on Wed Mar 31 10:13:23 2022
Um die aktuellen ip6tables-Regeln erweitern zu können, sollten diese erst einmal aufgelistet werden, was mit nachfolgendem Befehl durchgeführt werden kann:
Nachfolgende Befehle, fügen folgende ip6tables-Regeln dem ip6tables-Regelwerk nach der Position 4 hinzu, ohne das der Paketfilter angehalten werden muss:
Die neuen Zeilen sind an Position 5 (INPUT) und Postition 6 (INTPUT) zu sehen, hier nachfolgend zur Verdeutlichung noch einmal dargestellt (nur relevanter Ausschnitt):
Um diese ip6tables-Regel dauerhaft, auch nach einem Neustart des Server, weiterhin im ip6tables-Regelwerk zu speichern, muss nachfolgend dargestellter Befehl abschließend noch ausgeführt werden:
Nachfolgender Befehl kann dazu verwendet werden, um zu überprüfen, ob das ip6tables-Regelwerk auch korrekt gespeichert wurde:
# cat /etc/iptables/ip6tables.rules
# Generated by ip6tables-save v1.8.7 on Wed Mar 31 10:15:10 2022
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Wed Mar 31 10:15:10 2022
# Generated by ip6tables-save v1.8.7 on Wed Mar 31 10:15:10 2022
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -j LOG --log-prefix "REC-INP Defend " --log-level 5
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -p udp -j REJECT --reject-with icmp6-port-unreachable
-A INPUT -j REJECT --reject-with icmp6-addr-unreachable
-A FORWARD -j LOG --log-prefix "REC-FWD Defend " --log-level 5
-A FORWARD -p tcp -j REJECT --reject-with tcp-reset
-A FORWARD -p udp -j REJECT --reject-with icmp6-port-unreachable
-A FORWARD -j REJECT --reject-with icmp6-addr-unreachable
COMMIT
# Completed on Wed Mar 31 10:15:10 2022
# Generated by ip6tables-save v1.8.7 on Wed Mar 31 10:15:10 2022
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Wed Mar 31 10:15:10 2022
IPv4: Port Forwarding
Falls sich der Apache HTTP ServerNICHT auf dem Server befinden sollte, welcher z.B. die offizielle IP-Adresse verwaltet und auf diesem Server, welche die offizielle IP-Adresse inne hat, keinApache HTTP Server läuft, können auf z.B. Port 80 ankommende TCP/IP-Pakete mit Hilfe von iptables-Regeln auf einen anderen Server umgeleitet werden.
Beispiel:
Alle Anfragen kommen auf dem Server 192.168.0.1 auf Port 80 an
Alle Anfragen sollen auf den Server 192.168.0.90 auf Port 80 - weitergeleitet werden!
Nachfolgende Regel muss dazu auf dem Server, welche die IP-Adresse 192.168.0.1 inne hat, zum iptables-Regelwerk hinzugefügt werden. Das Ergänzen erfolgt in der iptables-Kette:
nat
Um die aktuellen iptables-Regeln erweitern zu können, sollten diese erst einmal aufgelistet werden, was mit nachfolgendem Befehl durchgeführt werden kann:
# iptables -t nat -nvL --line-numbers
Chain PREROUTING (policy ACCEPT 4 packets, 339 bytes)
num pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 1 packets, 60 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 8 packets, 573 bytes)
num pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 8 packets, 573 bytes)
num pkts bytes target prot opt in out source destination
WICHTIG - Bei der MASQUERADE-Regel darf NICHT das Interface enthalten sein, an dessen geFORWARDED wird !!!
Nachfolgender Befehl, fügen folgende iptables-Regel dem iptables-Regelwerk hinzu, ohne das der Paketfilter angehalten werden muss:
Um diese iptables-Regel dauerhaft, auch nach einem Neustart des Server, weiterhin im iptables-Regelwerk zu speichern, muss nachfolgend dargestellter Befehl abschließend noch ausgeführt werden:
HINWEIS - Die Ergänzungen sind in der 3 Zeile und 4 Zeile in oben gezeigter Konfigurationsdatei!
Somit kann gewährleistet werden, dass die Verwendung des DNS-Namens möglich ist.
Erster Start
Bevor weitereKonfigurationsschritte erfolgen, sollte dem ersten Start nichts im Wege stehen, da bereits hier Konfigurationseinstellungen durchgeführt werden, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl start httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
Webserver Überprüfung
Ob der Apache HTTP Server, sprich der httpd-Dienst/Deamon auch tatsächlich als Hintergrundprozess läuft, kann mit nachfolgendem Befehl überprüft werden:
# systemctl status httpd.service
● httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor pre>
Active: active (running) since Thu 2022-03-31 10:31:49 CEST; 5s ago
Main PID: 1240 (httpd)
Tasks: 82 (limit: 2340)
Memory: 6.2M
CPU: 15ms
CGroup: /system.slice/httpd.service
├─1240 /usr/bin/httpd -k start -DFOREGROUND
├─1241 /usr/bin/httpd -k start -DFOREGROUND
├─1242 /usr/bin/httpd -k start -DFOREGROUND
└─1243 /usr/bin/httpd -k start -DFOREGROUND
Mar 31 10:31:49 vml030 systemd[1]: Started Apache Web Server.
Wenn der Start des Apache HTTP Server erfolgreich durchgeführt wurde, kann die Abfrage mittels eines Browsers erfolgen, wie im nachfolgenden Bild dargestellt:
Konfigurationsdateien
Nachfolgende Aufstellung stellt die Konfigurationsdateien des Apache HTTP Server vor.
Das Apache HTTP Server-Modul mod_mime_magic bestimmt den MIME-Typ von Dateien auf dieselbe Weise wie der Unix-Befehl file: Es werden dabei die ersten paar Bytes der Datei betrachtet. Es ist als „zweite Verteidigungslinie“ für Fälle gedacht, die mod_mime nicht auflösen kann ACHTUNG - Die Datei magic sollte nicht bearbeitet werden, da diese bei einem Upgrade des Apache HTTP Server überschrieben werden könnte bzw. würde
mime.types
Medientypen-Konfigurationsdatei mit MIME-Dokumenttypen ACHTUNG - Die Datei mime.types sollte nicht bearbeitet werden, da diese bei einem Upgrade des Apache HTTP Server überschrieben werden könnte bzw. würde
/etc/httpd/conf/extra/
httpd-autoindex.conf
Beinhaltet Optionen für automatisch generierte Verzeichnis-Indizes
Beinhaltet zusätzliche Einstellungen für den Hauptserver
httpd-info.conf
Beinhaltet Einstellungen zu Statusmeldungen und Informationen des Servers, abrufbar unter speziellen URL-Ergänzungen /server-status und /server-info
httpd-languages.conf
Einstellungen für die Zuordnung zwischen zusätzlichen Dateiendungen und Dokumentsprachen
httpd-manual.conf
Einbindung der Apache HTTP Server-Dokumentation, abrufbar unter der URL-Ergänzung /manual
httpd-mpm.conf
MPM-spezifische Einstellungen, die vor allem die Performance betreffen
httpd-multilang-errordoc.conf
Beinhaltet Einstellungen für Mehrsprachige Fehlermeldungsseiten
httpd-ssl.conf
Beinhaltet die Einstellungen zur SSL-Konfiguration
httpd-userdir.conf
Beinhaltet die Einstellungen zur Veröffentlichung von benutzerdefinierter Web-Seiten unter dem z.B. HOME-Verzeichnis eines UNIX-Benutzers (~/user-URL-Pfade)
WICHTIG - Fett gedruckte Konfigurationsdateien sind standardmässig aktiv bzw. inkludiert!
HINWEIS - Die nachfolgenden Anpassungen sind individuell und vom jeweiligen Einsatzzweck abhängig und ggf. den persönlichen Bedürfnissen anzupassen!
Die nachfolgenden Anpassungen werden mit einem vorangestellten Kommentar in der Form
# Tachtler
gekennzeichnet.
Basis-Konfiguration
Nachfolgend sollen zuerst die Direktiven behandelt werden, welche für einen grundlegenden Betrieb eines Apache HTTP Server mit z.B. einer einfachen statischen Web-Seite wichtig sind. Es werden vorerst nur Konfigurationsanweisungen, welche mit dem Kern (core) des Apache HTTP Server behandelt werden können, bzw. in MPM-Modulen oder solchen Apache HTTP Server-Modulen verankert sind, welche standardmässig mit demApache HTTP Serverausgeliefert und aktiviert sind.
## This is the main Apache HTTP server configuration file. It contains the# configuration directives that give the server its instructions.# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.# In particular, see # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html># for a discussion of each configuration directive.## Do NOT simply read the instructions in here without understanding# what they do. They're here only as hints or reminders. If you are unsure# consult the online docs. You have been warned. ## Configuration and logfile names: If the filenames you specify for many# of the server's control files begin with "/" (or "drive:/" for Win32), the# server will use that explicit path. If the filenames do *not* begin# with "/", the value of ServerRoot is prepended -- so "logs/access_log"# with ServerRoot set to "/usr/local/apache2" will be interpreted by the# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'.## ServerRoot: The top of the directory tree under which the server's# configuration, error, and log files are kept.## Do not add a slash at the end of the directory path. If you point# ServerRoot at a non-local disk, be sure to specify a local disk on the# Mutex directive, if file-based mutexes are used. If you wish to share the# same ServerRoot for multiple httpd daemons, you will need to change at# least PidFile.#ServerRoot"/etc/httpd"## Mutex: Allows you to set the mutex mechanism and mutex file directory# for individual mutexes, or change the global defaults## Uncomment and change the directory if mutexes are file-based and the default# mutex file directory is not on a local disk or is not appropriate for some# other reason.## Mutex default:/run/httpd## Listen: Allows you to bind Apache to specific IP addresses and/or# ports, instead of the default. See also the <VirtualHost># directive.## Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses.##Listen 12.34.56.78:80Listen80## Dynamic Shared Object (DSO) Support## To be able to use the functionality of a module which was built as a DSO you# have to place corresponding `LoadModule' lines at this location so the# directives contained in it are actually available _before_ they are used.# Statically compiled modules (those listed by `httpd -l') do not need# to be loaded here.## Example:# LoadModule foo_module modules/mod_foo.so#LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so#LoadModule mpm_worker_module modules/mod_mpm_worker.soLoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so#LoadModule authn_anon_module modules/mod_authn_anon.so#LoadModule authn_dbd_module modules/mod_authn_dbd.so#LoadModule authn_socache_module modules/mod_authn_socache.soLoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so#LoadModule authz_owner_module modules/mod_authz_owner.so#LoadModule authz_dbd_module modules/mod_authz_dbd.soLoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.soLoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so#LoadModule auth_digest_module modules/mod_auth_digest.so#LoadModule allowmethods_module modules/mod_allowmethods.so#LoadModule file_cache_module modules/mod_file_cache.so#LoadModule cache_module modules/mod_cache.so#LoadModule cache_disk_module modules/mod_cache_disk.so#LoadModule cache_socache_module modules/mod_cache_socache.so#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so#LoadModule socache_dbm_module modules/mod_socache_dbm.so#LoadModule socache_memcache_module modules/mod_socache_memcache.so#LoadModule socache_redis_module modules/mod_socache_redis.so#LoadModule watchdog_module modules/mod_watchdog.so#LoadModule macro_module modules/mod_macro.so#LoadModule dbd_module modules/mod_dbd.so#LoadModule dumpio_module modules/mod_dumpio.so#LoadModule echo_module modules/mod_echo.so#LoadModule buffer_module modules/mod_buffer.so#LoadModule data_module modules/mod_data.so#LoadModule ratelimit_module modules/mod_ratelimit.soLoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so#LoadModule request_module modules/mod_request.soLoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule reflector_module modules/mod_reflector.so#LoadModule substitute_module modules/mod_substitute.so#LoadModule sed_module modules/mod_sed.so#LoadModule charset_lite_module modules/mod_charset_lite.so#LoadModule deflate_module modules/mod_deflate.so#LoadModule xml2enc_module modules/mod_xml2enc.so#LoadModule proxy_html_module modules/mod_proxy_html.so#LoadModule brotli_module modules/mod_brotli.soLoadModule mime_module modules/mod_mime.so
#LoadModule ldap_module modules/mod_ldap.soLoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so#LoadModule log_forensic_module modules/mod_log_forensic.so#LoadModule logio_module modules/mod_logio.so#LoadModule lua_module modules/mod_lua.soLoadModule 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.soLoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so#LoadModule usertrack_module modules/mod_usertrack.so#LoadModule unique_id_module modules/mod_unique_id.soLoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so#LoadModule proxy_module modules/mod_proxy.so#LoadModule proxy_connect_module modules/mod_proxy_connect.so#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so#LoadModule proxy_http_module modules/mod_proxy_http.so#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so#LoadModule proxy_express_module modules/mod_proxy_express.so#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so#LoadModule session_module modules/mod_session.so#LoadModule session_cookie_module modules/mod_session_cookie.so#LoadModule session_crypto_module modules/mod_session_crypto.so#LoadModule session_dbd_module modules/mod_session_dbd.soLoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so#LoadModule ssl_module modules/mod_ssl.so#LoadModule dialup_module modules/mod_dialup.so#LoadModule http2_module modules/mod_http2.so#LoadModule proxy_http2_module modules/mod_proxy_http2.so#LoadModule md_module modules/mod_md.so#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.soLoadModule unixd_module modules/mod_unixd.so
#LoadModule heartbeat_module modules/mod_heartbeat.so#LoadModule heartmonitor_module modules/mod_heartmonitor.so#LoadModule dav_module modules/mod_dav.soLoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule asis_module modules/mod_asis.so# Tachtler# default: #LoadModule info_module modules/mod_info.soLoadModule info_module modules/mod_info.so
#LoadModule suexec_module modules/mod_suexec.so
<IfModule !mpm_prefork_module>
#LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
#LoadModule cgi_module modules/mod_cgi.so
</IfModule>
#LoadModule dav_fs_module modules/mod_dav_fs.so#LoadModule dav_lock_module modules/mod_dav_lock.so#LoadModule vhost_alias_module modules/mod_vhost_alias.soLoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule imagemap_module modules/mod_imagemap.so#LoadModule actions_module modules/mod_actions.so#LoadModule speling_module modules/mod_speling.soLoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so
<IfModule unixd_module>
## If you wish httpd to run as a different user or group, you must run# httpd as root initially and it will switch. ## User/Group: The name (or #number) of the user/group to run httpd as.# It is usually good practice to create a dedicated user and group for# running httpd, as with most system services.#User http
Group http
</IfModule>
# 'Main' server configuration## The directives in this section set up the values used by the 'main'# server, which responds to any requests that aren't handled by a# <VirtualHost> definition. These values also provide defaults for# any <VirtualHost> containers you may define later in the file.## All of these directives may appear inside <VirtualHost> containers,# in which case these default settings will be overridden for the# virtual host being defined.### ServerAdmin: Your address, where problems with the server should be# e-mailed. This address appears on some server-generated pages, such# as error documents. e.g. admin@your-domain.com## Tachtler# default: ServerAdmin you@example.comServerAdmin webmaster@tachtler.net
## ServerName gives the name and port that the server uses to identify itself.# This can often be determined automatically, but we recommend you specify# it explicitly to prevent problems during startup.## If your host doesn't have a registered DNS name, enter its IP address here.## Tachtler# default: #ServerName www.example.com:80ServerName apache.tachtler.net:80## Deny access to the entirety of your server's filesystem. You must# explicitly permit access to web content directories in other # <Directory> blocks below.#
<Directory />
AllowOverridenoneRequireall denied
</Directory>
## Note that from this point forward you must specifically allow# particular features to be enabled - so if something's not working as# you might expect, make sure that you have specifically enabled it# below.### DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot"/srv/http"
<Directory"/srv/http">
## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.4/mod/core.html#options# for more information.## Tachtler# default: Options Indexes FollowSymLinksOptions -Indexes +FollowSymLinks## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# AllowOverride FileInfo AuthConfig Limit#AllowOverrideNone## Controls who can get stuff from this server.#Requireall granted
</Directory>
## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#
<IfModule dir_module>
# Tachtler# default: DirectoryIndex index.htmlDirectoryIndex index.html index.htm
</IfModule>
## The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. #
<Files".ht*">
Requireall denied
</Files>
## ErrorLog: The location of the error log file.# If you do not specify an ErrorLog directive within a <VirtualHost># container, error messages relating to that virtual host will be# logged here. If you *do* define an error logfile for a <VirtualHost># container, that host's errors will be logged there and not here.#ErrorLog"/var/log/httpd/error_log"## LogLevel: Control the number of messages logged to the error_log.# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg.#LogLevel warn
<IfModule log_config_module>
## The following directives define some format nicknames for use with# a CustomLog directive (see below).#LogFormat"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\"" combined
LogFormat"%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %OLogFormat"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\" %I %O" combinedio
</IfModule>
## The location and format of the access logfile (Common Logfile Format).# If you do not define any access logfiles within a <VirtualHost># container, they will be logged here. Contrariwise, if you *do*# define per-<VirtualHost> access logfiles, transactions will be# logged therein and *not* in this file.#CustomLog"/var/log/httpd/access_log" common
## If you prefer a logfile with access, agent, and referer information# (Combined Logfile Format) you can use the following directive.##CustomLog "/var/log/httpd/access_log" combined
</IfModule>
<IfModule alias_module>
## Redirect: Allows you to tell clients about documents that used to # exist in your server's namespace, but do not anymore. The client # will make a new request for the document at its new location.# Example:# Redirect permanent /foo http://www.example.com/bar## Alias: Maps web paths into filesystem paths and is used to# access content that does not live under the DocumentRoot.# Example:# Alias /webpath /full/filesystem/path## If you include a trailing / on /webpath then the server will# require it to be present in the URL. You will also likely# need to provide a <Directory> section to allow access to# the filesystem path.## ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that# documents in the target directory are treated as applications and# run by the server when requested rather than as documents sent to the# client. The same rules about trailing "/" apply to ScriptAlias# directives as to Alias.#ScriptAlias /cgi-bin/ "/srv/http/cgi-bin/"
</IfModule>
<IfModule cgid_module>
## ScriptSock: On threaded servers, designate the path to the UNIX# socket used to communicate with the CGI daemon of mod_cgid.##Scriptsock cgisock
</IfModule>
## "/srv/http/cgi-bin" should be changed to whatever your ScriptAliased# CGI directory exists, if you have that configured.#
<Directory"/srv/http/cgi-bin">
AllowOverrideNoneOptionsNoneRequireall granted
</Directory>
<IfModule headers_module>
## Avoid passing HTTP_PROXY environment to CGI's on this or any proxied# backend servers which have lingering "httpoxy" defects.# 'Proxy' request header is undefined by the IETF, not listed by IANA#RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
## TypesConfig points to the file containing the list of mappings from# filename extension to MIME-type.#TypesConfig conf/mime.types
## AddType allows you to add to or override the MIME configuration# file specified in TypesConfig for specific file types.##AddType application/x-gzip .tgz## AddEncoding allows you to have certain browsers uncompress# information on the fly. Note: Not all browsers support this.##AddEncoding x-compress .Z#AddEncoding x-gzip .gz .tgz## If the AddEncoding directives above are commented-out, then you# probably should define those extensions to indicate media types:#AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
## AddHandler allows you to map certain file extensions to "handlers":# actions unrelated to filetype. These can be either built into the server# or added with the Action directive (see below)## To use CGI scripts outside of ScriptAliased directories:# (You will also need to add "ExecCGI" to the "Options" directive.)##AddHandler cgi-script .cgi# For type maps (negotiated resources):#AddHandler type-map var## Filters allow you to process content before it is sent to the client.## To parse .shtml files for server-side includes (SSI):# (You will also need to add "Includes" to the "Options" directive.)##AddType text/html .shtml#AddOutputFilter INCLUDES .shtml
</IfModule>
## The mod_mime_magic module allows the server to use various hints from the# contents of the file itself to determine its type. The MIMEMagicFile# directive tells the module where the hint definitions are located.##MIMEMagicFile conf/magic## Customizable error responses come in three flavors:# 1) plain text 2) local redirects 3) external redirects## Some examples:#ErrorDocument 500 "The server made a boo boo."#ErrorDocument 404 /missing.html#ErrorDocument 404 "/cgi-bin/missing_handler.pl"#ErrorDocument 402 http://www.example.com/subscription_info.html### MaxRanges: Maximum number of Ranges in a request before# returning the entire resource, or one of the special# values 'default', 'none' or 'unlimited'.# Default setting is to accept 200 Ranges.#MaxRanges unlimited## EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall may be used to deliver# files. This usually improves server performance, but must# be turned off when serving from networked-mounted # filesystems or if support for these functions is otherwise# broken on your system.# Defaults: EnableMMAP On, EnableSendfile Off##EnableMMAP off#EnableSendfile on# Supplemental configuration## The configuration files in the conf/extra/ directory can be # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary.# Server-pool management (MPM specific)Include conf/extra/httpd-mpm.conf
# Multi-language error messagesInclude conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listingsInclude conf/extra/httpd-autoindex.conf
# Language settingsInclude conf/extra/httpd-languages.conf
# User home directories# Tachtler# default: Include conf/extra/httpd-userdir.conf#Include conf/extra/httpd-userdir.conf# Real-time info on requests and configuration#Include conf/extra/httpd-info.conf# Virtual hosts#Include conf/extra/httpd-vhosts.conf# Local access to the Apache HTTP Server Manual#Include conf/extra/httpd-manual.conf# Distributed authoring and versioning (WebDAV)#Include conf/extra/httpd-dav.conf# Various default settingsInclude conf/extra/httpd-default.conf
# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
# Secure (SSL/TLS) connections#Include conf/extra/httpd-ssl.conf## Note: The following must must be present to support# starting without SSL on platforms with no /dev/random equivalent# but a statically compiled-in mod_ssl.#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Erklärungen:
LoadModule info_module modules/mod_info.so
Die Einbindung des Moduls mod_info ist erforderlich, wenn über eine URL-Erweiterung Informationen über die Konfiguration des Apache HTTP Servers im HTML-Format angezeigt werden sollen.
E-Mail-Adresse des Apache HTTP Server-Administrators für automatisch generierte Fehlermeldungensseiten. Wenn der Apache HTTP Server bei der Beantwortung von Client-Anfragen auf Probleme stößt, wird eine angepasste Fehlermeldungsseite erzeugt, welche unter Umständen auch die zusätzliche Ausgabe eines Links mit der E-Mail-Adresse des Apache HTTP Server-Administrators enthalten kann.
Siehe auch nachfolgenden externen Link: ServerSignature
ServerName apache.tachtler.net:80
Hostname und TCP-Port des Apache HTTP Servers. Der hier angegeben Name dient ausschließlich und nur der Selbstindentifikation des Apache HTTP Servers. Ob dieser auch für selbst referenzierende URLs benutzt werden soll, regelt nachfolgende Direktive:
Siehe nachfolgenden externen Link: UseCanonicalName
Options -Indexes +FollowSymLinks
Definiert, welche Eigenschaften oder Funktionen in einem bestimmten Verzeichnis verfügbar sind.
Options kann auf None gesetzt werden, wobei dann keine der besonderen Eigenschaften verfügbar wäre, oder auf eines oder mehrere der nachfolgenden Tabelle:
Eigenschaft
Beschreibung
All
Alle Optionen außer MultiViews. Dies ist die Voreinstellung.
ExecCGI
Die Ausführung von CGI-Skripten, welche mod_cgi verwenden, ist erlaubt.
FollowSymLinks
Der Server folgt symbolischen Links in diesem Verzeichnis. Auch wenn der Server symbolischen Links folgt, bedeutet dies nicht, dass der zum Abgleich gegen <Directory>-Abschnitte verwendete Pfadname wechselt. Es ist auch zu beachten, dass diese Option innerhalb eines <Location>-Abschnitts ignoriert wird.
Includes
Server Side Includes, die von mod_include bereitgestellt werden, sind erlaubt.
IncludesNOEXEC
Server Side Includes sind erlaubt, #exec cmd und #exec cgi sind jedoch deaktiviert. Es ist aber noch möglich, CGI-Skripte aus ScriptAlias-Verzeichnissen mittels #include virtual einzubinden.
Indexes
Wenn eine URL, die auf ein Verzeichnis zeigt, in dem sich keine durch DirectoryIndex definierte Indexdatei (z.B. index.html) befindet, dann liefert mod_autoindex eine formatierte Auflistung des Verzeichnisses zurück.
MultiViews
„MultiViews“ sind bei der Verwendung von mod_negotiation erlaubt (siehe Content-Negotiation).
SymLinksIfOwnerMatch
Der Server folgt nur symbolischen Links, bei denen die Zieldatei bzw. das Zielverzeichnis der gleichen Benutzerkennung gehört, wie der Link.
ACHTUNG - Die Vermischung von Optionen mit + oder - mit Optionen ohne diese (Zeichen) ist keine gültige Syntax und führt mit hoher Wahrscheinlichkeit zu unerwarteten Effekten.
Name(n) der Index-Seiten. Hier werden die Namen definiert, die der Apache HTTP Server automatisch ergänzt und ausliefert, wenn anstelle einer expliziten Datei, ein Verzeichnis vom Client angefordert wurde. Dies ist zwingend erforderlich, damit Benutzer einer Web-Seite wie z.B. http://www.tachtler.net anfragen können, ohne einen Namen der gewünschten Datei selbst angeben zu müssen. Der Apache HTTP Server wird die Reihenfolge von links nach rechts durchgehen und die Datei ausliefern, welche zuerst gefunden wurde.
#Include conf/extra/httpd-userdir.conf
Excludieren durch Auskommentierung der Konfigurationsdatei /etc/httpd/conf/extra/httpd-userdir.conf. Diese Beinhaltet die Einstellungen zur Veröffentlichung von benutzerdefinierter Web-Seiten unter dem z.B. HOME-Verzeichnis eines UNIX-Benutzers (~/user-URL-Pfade) und soll hier nicht zur Anwendung kommen, da sonst z.B. Benutezr mit einem shell-Account eigene Web-Inhalte unkontrolliert zur Verfügung stellen könnten.
Include conf/extra/httpd-info.conf
Includieren durch Einkommentierung der Konfigurationsdatei /etc/httpd/conf/extra/httpd-info.conf. Diese Konfigurationsdatei beinhaltet Einstellungen zu Statusmeldungen und Informationen des Servers, abrufbar unter speziellen URL-Ergänzungen /server-status und /server-info.
Durch Neuanlage einer HTML-Datei in nachfolgendem Verzeichnis mit nachfolgendem Inhalt und nachfolgendem Befehl, kann die Auslieferung einer minimalistischen statischen Web-Seite durch den Apache HTTP Server erreicht werden:
# vim /srv/http/index.html
Nachfolgend der Inahlt:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>It works! Apache httpd</title></head><body><p>It works!</p></body></html>
Basis-Konfiguration: Neustart
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
Basis-Konfiguration: Tests
Wenn der Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, kann die Abfrage mittels eines Browsers erfolgen, wie im nachfolgenden Bild dargestellt:
Durch anhängen nachfolgenden Zusatzes an die URL, wie z.B. /NotFound
kann - sofern keine Datei mit diesem Namen im Verzeichnis /srv/http vorhanden ist, eine Fehlermeldung - hier Code: 404 erzeugt werden, wie nachfolgender Aufruf zeigt:
Wie zu sehen ist, ist die Fehlermeldung in
deutscher Sprache
da dies im Browser als die bevorzugte Sprache eingestellt wurde.
Weiterhin ist auch das Ergebnis der Konfiguration der E-Mail-Adresse mittels der Direktive
ServerAdmin webmaster@tachtler.net
zu sehen, wenn eine Fehlermeldung generiert wird und der Mauszeiger über den Link - Webmaster bewegt wird.
default-Konfiguration
Nachfolgende Konfigurationen betreffenn grundlegende Konfigurationen des Apache HTTP Servers
## This configuration file reflects default settings for Apache HTTP Server.## You may change these, but chances are that you may not need to.### Timeout: The number of seconds before receives and sends time out.#Timeout60## KeepAlive: Whether or not to allow persistent connections (more than# one request per connection). Set to "Off" to deactivate.#KeepAliveOn## MaxKeepAliveRequests: The maximum number of requests to allow# during a persistent connection. Set to 0 to allow an unlimited amount.# We recommend you leave this number high, for maximum performance.#MaxKeepAliveRequests100## KeepAliveTimeout: Number of seconds to wait for the next request from the# same client on the same connection.#KeepAliveTimeout5## UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables.# When set "Off", Apache will use the Hostname and Port supplied# by the client. When set "On", Apache will use the value of the# ServerName directive.#UseCanonicalNameOff## AccessFileName: The name of the file to look for in each directory# for additional configuration directives. See also the AllowOverride # directive.#AccessFileName .htaccess
## ServerTokens# This directive configures what you return as the Server HTTP response# Header. The default is 'Full' which sends information about the OS-Type# and compiled in modules.# Set to one of: Full | OS | Minor | Minimal | Major | Prod# where Full conveys the most information, and Prod the least.#ServerTokens Full
## Optionally add a line containing the server version and virtual host# name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents).# Set to "EMail" to also include a mailto: link to the ServerAdmin.# Set to one of: On | Off | EMail#ServerSignatureOff## HostnameLookups: Log the names of clients or just their IP addresses# e.g., www.apache.org (on) or 204.62.129.132 (off).# The default is off because it'd be overall better for the net if people# had to knowingly turn this feature on, since enabling it means that# each client request will result in AT LEAST one lookup request to the# nameserver.#HostnameLookupsOff## Set a timeout for how long the client may take to send the request header# and body.# The default for the headers is header=20-40,MinRate=500, which means wait# for the first byte of headers for 20 seconds. If some data arrives,# increase the timeout corresponding to a data rate of 500 bytes/s, but not# above 40 seconds.# The default for the request body is body=20,MinRate=500, which is the same# but has no upper limit for the timeout.# To disable, set to header=0 body=0#
<IfModule reqtimeout_module>
RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
</IfModule>
Erklärungen:
ServerTokens Prod
Ausführlichkeitseinstellung für die Ausgabe der Verionsangabe des für den HTTP-Antwort-Header: Server. Diese Direktive legt fest, wie ausführlich der Apache HTTP Server dessen Versionsinformationen im HTTP-Antwort-Header: Server und in der durch ServerSignature definierten Fußzeile von automatisch generierten Dokumenten ausgibt und die INformationen die an den Client zurückgesendet werden, die eine Beschreibung des allgemeinen Betriesbsystemtyps des Servers wie auch Informationen über einkompilierte Module enthält.
Einstellung
Beschreibung
ServerTokens Prod[uctOnly]
Der Server sendet (z.B.): Server: Apache
ServerTokens Major
Der Server sendet (z.B.): Server: Apache/2
ServerTokens Minor
Der Server sendet (z.B.): Server: Apache/2.4
ServerTokens Min[imal]
Der Server sendet (z.B.): Server: Apache/2.4.53
ServerTokens OS
Der Server sendet (z.B.): Server: Apache/2.4.53 (Unix)
ServerTokens Full
Standard wenn nicht angegeben - Der Server sendet (z.B.): Server: Apache/2.4.53 (Unix) PHP/7.4.28
HINWEIS - Diese Einstellung gilt für den gesamten Server und kann nicht auf Virtual-Host-Basis aktiviert oder deaktiviert werden.
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
default-Konfiguration: Tests
Wenn ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, kann die Abfrage mittels eines Browsers erfolgen, wie im nachfolgenden Bild dargestellt:
Durch erneutes anhängen nachfolgenden Zusatzes an die URL, wie z.B. /NotFound
kann erneut - sofern immer noch keine Datei mit diesem Namen im Verzeichnis /srv/http vorhanden ist, eine Fehlermeldung - hier Code: 404 erzeugt werden, wie nachfolgender Aufruf zeigt:
Wie zu sehen ist, ist auch das Ergebnis der Konfiguration der Apache HTTP Server-Versionsinformationsanzeige mittels der Direktive
ServerTokens Prod
wenn eine Fehlermeldung generiert wird, nun weniger gesprächig.
/usr/share/httpd/error/include/bottom.html
Wenn eine Fehlerseite ausgegeben wird, wird aktuell keine Datum und keine Uhrzeit mit der Fehlerseite mehr angezeigt, wie nachfolgendes Beispiel demonstriert:
Wenn nach der vorangestellten Konfiguration eine Fehlerseite ausgegeben wird, wird das aktuelle Datum und die aktuelle Uhrzeit mit der Fehlerseite angezeigt, wie nachfolgendes Beispiel demonstriert:
ACHTUNG - Leider muss die Anpassung der Konfigurationsdatei /usr/share/httpd/error/include/bottom.html nach jedem Apache HTTP Server-Update erneut vorgenommen werden!
info-Konfiguration
Nachfolgende Konfiguration ermöglicht es zwei URL-Erweiterungen zu implementieren, welche unter
/server-status - Statusinformationen zum Server bzw. virtuellen Host
?auto - Maschinell lesbare Ausgabe erzeugen
?refresh=N - Automatische Aktualisierung alle N Sekunden
/server-info - Informationen zu Modulnamen, Konfigurationen, Hooks, Modulen und dem Server selbst
?Modulname - Beschränkung der Ausgabe von Informationen zu einem Modul mit dem angegeben Namen
?config - Ausgabe der Konfiguration inklusive aller inkludierten Konfigurationsdateien
?hooks - Ausgabe nur der einzelnen Hooks, mit denen die Module verknüpft sind
?list - Ausgabe einer einfachen Liste aller geladenen Module
## Get information about the requests being processed by the server# and the configuration of the server.## Required modules: mod_authz_core, mod_authz_host,# mod_info (for the server-info handler),# mod_status (for the server-status handler)## Allow server status reports generated by mod_status,# with the URL of http://servername/server-status# Change the ".example.com" to match your domain to enable.
<Location /server-status>
SetHandler server-status
# Tachtler # default: Require host .example.com# default: Require ip 127Requireall granted
</Location>
## ExtendedStatus controls whether Apache will generate "full" status# information (ExtendedStatus On) or just basic information (ExtendedStatus# Off) when the "server-status" handler is called. The default is Off.## Tachtler# default: #ExtendedStatus OnExtendedStatusOn# Tachtler - NEW -SeeRequestTailOn## Allow remote server configuration reports, with the URL of# http://servername/server-info (requires that mod_info.c be loaded).# Change the ".example.com" to match your domain to enable.#
<Location /server-info>
SetHandler server-info
# Tachtler # default: Require host .example.com# default: Require ip 127Requireall granted
</Location>
Erklärungen:
Requireall granted
Zugriff auf die URL-Erweiterung /server-status, ohne Beschränkungen.
Siehe auch nachfolgenden externen Link: Require
HINWEIS - Der Zugriff auf diese URL-Erweiterung sollte durch eine Zugriffsbeschränkung eingeschränkt werden
Statusinformationen für jede einzelne Abfrage aktivieren. Beim setzen auf On werden auch zusätzlich Informationen über jede einzelne Abfrage angezeigt.
SeeRequestTailOn
Anzeige der letzten 63 Zeichen aller Statusinformationen für jede einzelne Abfrage und nicht der ersten 63 Zeichen, was der Standard wäre
Requireall granted
Zugriff auf die URL-Erweiterung /server-info, ohne Beschränkungen.
Siehe auch nachfolgenden externen Link: Require
HINWEIS - Der Zugriff auf diese URL-Erweiterung sollte durch eine Zugriffsbeschränkung eingeschränkt werden
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
info-Konfiguration: Tests
Wenn ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, können nachfolgende Abfragen mittels eines Browsers erfolgen, wie in nachfolgenden Bildern dargestellt durchgeführt werden:
Durch anhängen nachfolgenden Zusatzes an die URL: /server-status
## Settings for hosting different languages.## Required modules: mod_mime, mod_negotiation# DefaultLanguage and AddLanguage allows you to specify the language of # a document. You can then use content negotiation to give a browser a # file in a language the user can understand.## Specify a default language. This means that all data# going out without a specific language tag (see below) will # be marked with this one. You probably do NOT want to set# this unless you are sure it is correct for all cases.## * It is generally better to not mark a page as # * being a certain language than marking it with the wrong# * language!## DefaultLanguage nl## Note 1: The suffix does not have to be the same as the language# keyword --- those with documents in Polish (whose net-standard# language code is pl) may wish to use "AddLanguage pl .po" to# avoid the ambiguity with the common suffix for perl scripts.## Note 2: The example entries below illustrate that in some cases # the two character 'Language' abbreviation is not identical to # the two character 'Country' code for its country,# E.g. 'Danmark/dk' versus 'Danish/da'.## Note 3: In the case of 'ltz' we violate the RFC by using a three char# specifier. There is 'work in progress' to fix this and get# the reference data for rfc1766 cleaned up.## Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)# Norwegian (no) - Polish (pl) - Portugese (pt)# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)# Turkish (tr) - Simplified Chinese (zh-CN) - Spanish (es)# Traditional Chinese (zh-TW)#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 tr .tr
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw
# LanguagePriority allows you to give precedence to some languages# in case of a tie during content negotiation.## Just list the languages in decreasing order of preference. We have# more or less alphabetized them here. You probably want to change this.## Tachtler# default: 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 tr zh-CN zh-TWLanguagePriority de en ca cs da el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW
## ForceLanguagePriority allows you to serve a result page rather than# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)# [in case no accepted languages matched the available variants]#ForceLanguagePriority Prefer Fallback
## Commonly used filename extensions to character sets. You probably# want to avoid clashes with the language extensions, unless you# are good at carefully testing your setup after each change.# See http://www.iana.org/assignments/character-sets for the# official list of charset names and their respective RFCs.#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-13AddCharset 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
# For russian, more than one charset is used (depends on client, mostly):AddCharset WINDOWS-1251 .cp-1251 .win-1251AddCharset 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
#Not sure how euc-tw got in - IANA doesn't list it???AddCharset EUC-TW .euc-tw
AddCharset gb2312 .gb2312 .gb
AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4AddCharset shift_jis .shift_jis .sjis
Erklärungen:
LanguagePriority de en ca cs da el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW
Änderung der Reihenfolge des zu verwendenden Sprache, wenn der anfragende Clinet, keine Sprachpräferenzen mit angefordert hat.
Bevor ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt werden soll, ist es erforderlich für den nachfolgenden Test die Konfigurationsdatei /etc/httpd/conf/httpd.conf erneut zu verändern.
Nachfolgende die Ergänzung, welche vorgenommen werden soll:
(Nur relevanter Ausschnitt):
...
...
...
## DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot"/srv/http"
<Directory"/srv/http">
## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.4/mod/core.html#options# for more information.## Tachtler# default: Options Indexes FollowSymLinksOptions -Indexes +FollowSymLinks +MultiViews
## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# AllowOverride FileInfo AuthConfig Limit#AllowOverrideNone## Controls who can get stuff from this server.#Requireall granted
</Directory>
...
...
...
Erklärungen:
Options -Indexes +FollowSymLinks +MultiViews
Das hinzufügen der Option +MultiViews, generiert anhand der Dateiendungen und anhand der Standard MIME-Grundeinstellungen automatisch eine Type-Map. Die Multiview-Suche funktioniert nach nachfolgendem Schema. Es wir eine Datei vom Client angefordert, da diese aber mit genau diesem Dateinamen nicht vorhanden ist, hier index.html, wird eine Content-Negotiation durchgeführt und nach dieser Datei mit einer Sprachendung, wie hier z.B. .de oder .en gesucht und diese dann versucht auszuliefern.
languages-Konfiguration: /srv/http/index.html.de und /srv/http/index.html.en
Bevor ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt werden soll, soll zuerst nachfolgende Datei, falls diese bereits vorhanden sein sollte, wie folgt gelöscht werden:
# rm /srv/http/index.html
Anschließend sollten zwei neue Dateien
/srv/http/index.html.de
/srv/http/index.html.en
mit nachfolgenden Befehelen und Inhalt wie nachfolgend dargestellt angelegt werden:
(Komplette HTML-Dateien):
# vim /srv/http/index.html.de
Nachfolgend der Inhalt:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Es funktioniert! Apache httpd</title></head><body><p>Es funktioniert!</p></body></html>
# vim /srv/http/index.html.en
Nachfolgend der Inhalt:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>It works! Apache httpd</title></head><body><p>It works!</p></body></html>
languages-Konfiguration: Neustart
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
languages-Konfiguration: Tests
Wenn ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, können nachfolgende Abfragen mittels des shell-Werkzeuges - telnet - wie folgt durchgeführt werden:
Nachfolgende drei Zeilen sind einzugeben und dann muss zwei mal die [Enter/Return]-Taste gedrückt werden, um nachfolgende Ausgabe zu erzeugen:
# telnet apache.tachtler.net 80
GET / HTTP/1.0
Host: apache.tachtler.net
(Nachfolgend die tatsächliche Ausführung):
# telnet apache.tachtler.net 80
Trying 192.168.0.30...
Connected to apache.tachtler.net.
Escape character is '^]'.
GET / HTTP/1.0
Host: apache.tachtler.net
HTTP/1.1 200 OK
Date: Sun, 10 Apr 2022 05:17:15 GMT
Server: Apache
Content-Location: index.html.de
Vary: negotiate,accept-language
TCN: choice
Last-Modified: Mon, 04 Apr 2022 18:54:46 GMT
ETag: "cd-5dbd8a97fc84d"
Accept-Ranges: bytes
Content-Length: 205
Connection: close
Content-Type: text/html
Content-Language: de
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Es funktioniert! Apache httpd</title></head><body><p>Es funktioniert!</p></body></html>
Connection closed by foreign host.
HINWEIS - Falls die LanguagePriority entsprechend angepasst wurde und der Client keine Sprachpräferenz sendet, wird Eine Sprache nach der Anderen der Reihenfolge nach angewendet, die z.B. de, an die angeforderte Datei angehängt und falls die so neu entstandene Datei gefunden wird, ausgeliefert!
Nachfolgend eine ähnliches Beispiel, nur mit Angabe einer Sprachpräferenz, hier z.B. en
Nachfolgende vier Zeilen sind einzugeben und dann muss zwei mal die [Enter/Return]-Taste gedrückt werden, um nachfolgende Ausgabe zu erzeugen:
# telnet apache.tachtler.net 80
GET / HTTP/1.0
Host: apache.tachtler.net
Accept-Language: en
(Nachfolgend die tatsächliche Ausführung):
# telnet apache.tachtler.net 80
Trying 192.168.0.30...
Connected to apache.tachtler.net.
Escape character is '^]'.
GET / HTTP/1.0
Host: apache.tachtler.net
Accept-Language: en
HTTP/1.1 200 OK
Date: Sun, 10 Apr 2022 05:23:12 GMT
Server: Apache
Content-Location: index.html.en
Vary: negotiate,accept-language
TCN: choice
Last-Modified: Sun, 03 Apr 2022 15:49:41 GMT
ETag: "bf-5dbc1f5c29f80"
Accept-Ranges: bytes
Content-Length: 191
Connection: close
Content-Type: text/html
Content-Language: en
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>It works! Apache httpd</title></head><body><p>It works!</p></body></html>
Connection closed by foreign host.
## The configuration below implements multi-language error documents through# content-negotiation.## Required modules: mod_alias, mod_authz_core, mod_authz_host,# mod_include, mod_negotiation## We use Alias to redirect any /error/HTTP_<error>.html.var response to# our collection of by-error message multi-language collections. We use # includes to substitute the appropriate text.## You can modify the messages' appearance without changing any of the# default HTTP_<error>.html.var files by adding the line:## Alias /error/include/ "/your/include/path/"## which allows you to create your own set of files by starting with the# /usr/share/httpd/error/include/ files and copying them to /your/include/path/, # even on a per-VirtualHost basis. The default include files will display# your Apache version number and your ServerAdmin email address regardless# of the setting of ServerSignature.Alias /error/ "/usr/share/httpd/error/"
<Directory"/usr/share/httpd/error">
AllowOverrideNoneOptions IncludesNoExec
AddOutputFilterIncludes html
AddHandler type-map var
Requireall granted
# Tachtler# default: LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv trLanguagePriority de en cs es fr it ja ko nl pl pt-br ro sv tr
ForceLanguagePriority Prefer Fallback
</Directory>
ErrorDocument400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument410 /error/HTTP_GONE.html.var
ErrorDocument411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
Erklärungen:
LanguagePriority de en cs es fr it ja ko nl pl pt-br ro sv tr
Änderung der Reihenfolge des zu verwendenden Sprache, wenn der anfragende Clinet, keine Sprachpräferenzen mit angefordert hat und eine Fehlermeldung erzeugt wird, da eine Anfrage nicht, aus welchem Grund auch immer, beantwortet werden kann.
multilang-errordoc-Konfiguration: Neustart
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
multilang-errordoc-Konfiguration: Test
Wenn ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, können nachfolgende Abfragen mittels des shell-Werkzeuges - telnet - wie folgt durchgeführt werden:
Nachfolgende drei Zeilen sind einzugeben und dann muss zwei mal die [Enter/Return]-Taste gedrückt werden, um nachfolgende Ausgabe zu erzeugen:
# telnet apache.tachtler.net 80
GET /NotFound HTTP/1.0
Host: apache.tachtler.net
(Nachfolgend die tatsächliche Ausführung):
# telnet apache.tachtler.net 80
Trying 192.168.0.30...
Connected to apache.tachtler.net.
Escape character is '^]'.
GET /NotFound HTTP/1.0
Host: apache.tachtler.net
HTTP/1.1 404 Not Found
Date: Sun, 10 Apr 2022 05:52:46 GMT
Server: Apache
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Connection: close
Content-Type: text/html; charset=utf-8
Content-Language: de
Expires: Sun, 10 Apr 2022 05:52:46 GMT
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"lang="de" xml:lang="de"><head><title>Objekt nicht gefunden!</title><linkrev="made"href="mailto:webmaster@tachtler.net"/><styletype="text/css"><!--/*--><![CDATA[/*><!--*/ body { color: #000000; background-color: #FFFFFF; } a:link { color: #0000CC; } p, address {margin-left: 3em;} span {font-size: smaller;}/*]]>*/--></style></head><body><h1>Objekt nicht gefunden!</h1><p>
Der angeforderte URL konnte auf dem Server nicht gefunden werden.
Sofern Sie den URL manuell eingegeben haben,
überprüfen Sie bitte die Schreibweise und versuchen Sie es erneut.
</p><p>
Sofern Sie dies für eine Fehlfunktion des Servers halten,
informieren Sie bitte den
<ahref="mailto:webmaster@tachtler.net">Webmaster</a>
hierüber.
</p><h2>Error 404</h2><address><ahref="/">apache.tachtler.net</a><br/><!-- # Tachtler - new --><span>Sunday, 10-Apr-2022 07:52:46 CEST</span><br/><!-- # Tachtler - end --><span>Apache</span></address></body></html>
Connection closed by foreign host.
HINWEIS - Falls die LanguagePriority entsprechend angepasst wurde und der Client keine Sprachpräferenz sendet, wird Eine Sprache nach der Anderen der Reihenfolge nach angewendet und ausgeliefert!
Basic Authentifizierung
Die einfachtste Art der Authetifizierung mittels basic Authentifizierung in Kombination mit einfachen Text-Dateien.
Basic Authentifizierung: htpasswd
Mit nachfolgendem Befehl kann eine neue Passwortdatei innerhalb eines Verzeichnisses, hier z.B.
/etc/httpd/conf
wie folgt erzeugt werden:
# htpasswd -c -B -C 6 /etc/httpd/conf/.htpasswd klaus
New password:
Re-type new password:
Adding password for user klaus
Erklärungen:
Die verwendeten Parameter haben nachfolgende Bedeutung:
Parameter
Erklärung
-c
Erstellt eine neue Passwortdatei mit dem angegebenen Dateinamen
-B
Erzwingen Sie die bcrypt-Verschlüsselung des Passworts (sehr sicher).
-C 6
Legen die für den bcrypt-Algorithmus verwendete Berechnungszeit fest
(höher ist sicherer, aber langsamer, Standard: 5, gültig: 4 bis 17).
/etc/httpd/conf/.htpasswd
Pfad und Dateiname für die Passwortdatei - hier .htpasswd
klaus
Benutzername, welcher der Passwortdatei hinzugefügt werden soll
HINWEIS - Der Befehl ohne die Option -c fügt einen weiteren Benutzer hinzu!
Mit nachfolgendem Befehl kann eine bestehende Passwortdatei innerhalb eines Verzeichnisses, hier z.B.
/etc/httpd/conf/.htpasswd
wie folgt um einen weiteren Benutzernamen erweitert werden:
# htpasswd -B -C 6 /etc/httpd/conf/.htpasswd petra
New password:
Re-type new password:
Adding password for user petra
HINWEIS - Benutzer können durch einfaches entfernen der jeweiligen Zeile aus der Passwortdateientfernt werden!
Nachfolgende Befehle setzen noch die richtigen Besitz- und Dateirechte für die soeben neu erstellt Passwortdatei - /etc/httpd/conf/.htpasswd:
Besitzrechte:
# chown root.http /etc/httpd/conf/.htpasswd
Dateirechte:
# chmod 640 /etc/httpd/conf/.htpasswd
Mit nachfolgendem Befehl kann überprüft werden, ob die Erstellung und das Setzen der Besitz- und Dateirechte wie gewünscht durchgeführt wurde
Anschliessend sind nachfolgende minimale Änderungen, hier an der Konfigurationsdatei
/etc/httpd/conf/httpd.conf
im Bereich DocumentRoot durchzuführen:
(Nur relevanter Ausschnitt):
...
...
...
## DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot"/srv/http"
<Directory"/srv/http">
## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.4/mod/core.html#options# for more information.## Tachtler# default: Options Indexes FollowSymLinksOptions -Indexes +FollowSymLinks +MultiViews
## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# AllowOverride FileInfo AuthConfig Limit#AllowOverrideNone## Controls who can get stuff from this server.## Tachtler# default: Require all grantedAuthType Basic
AuthName"Password protected area!"AuthUserFile conf/.htpasswd
Require valid-user
</Directory>
...
...
...
Anstelle der Standard Zugriffsrechte - Require all granted ist es erforderlich die vorhergehend gezeigt Konfiguration, welche minimal aus den Komponenten:
AuthType - Art der Authentifizierung
AuthName - Text der vom Client angezeigt werden kann, welcher bei der Authentifizierung präsentiert werden soll
AuthUserFile - Relativer Pfad zur Direktive ServerRoot″/etc/httpd″
Require valid-user - Zugriffsformulierung, hier „gültige Benutzer“
Basic Authentifizierung: htpasswd - Neustart
Bevor weitereKonfigurationsschritte erfolgen, sollte ein Neustart erfolgen, was mit nachfolgendem Befehl durchgeführt werden kann:
# systemctl restart httpd.service
HINWEIS - Es erfolgen keine weiteren Ausgaben, wenn der Start erfolgreich war !
Basic Authentifizierung: htpasswd - Test
Wenn ein erneuter Neustart des Apache HTTP Server erfolgreich durchgeführt wurde, kann die Abfrage mittels eines Browsers erfolgen, wie im nachfolgenden Bild dargestellt:
Hier geht es weiter… / To be continued…
Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
tachtler/apache_http_server_archlinux.1649700148.txt.gz · Zuletzt geändert: 2022/04/11 20:02 von klaus