Lukáš Bařinka
© 2021
REV 2.10
apache2
apache2-mpm-?
apache2-utils
apache2-bin
apache2-common
libapache2-mod-*
httpd
httpd-manual
apr-util
postgresql-libs
wget https://www.apache.org/dist/httpd/httpd-2.4.46.tar.gz
wget https://www.apache.org/dist/httpd/httpd-2.4.46.tar.gz.sha256
It can be used curl -O
instead of curl
It's better to use address from local mirror
Místo wget lze použít také curl -O
Adresu lépe z lokálního zrcadla
sha256sum -c httpd-2.4.46.tar.gz.sha256
gunzip httpd-2.4.46.tar.gz
tar xf httpd-2.4.46.tar
cd httpd-2.4.46
./configure && make && make install
./configure --help
--enable-layout=LAYOUT
--prefix=DIR
--enable-FEATURE / --disable-FEATURE
Zahrne/nezahrne danou vlastnost do instalace
--enable-modules=MODULE-LIST
all | most | module1,..,moduleN
--with-PACKAGE / --without-PACKAGE
Použije/nepoužije balík
/etc/apache2/ | global configuration |
/etc/apache2/mods-available | modules configuration |
/etc/apache2/sites-available | virtualhosts configuration |
/etc/apache2/conf-available | additional features configuration |
/usr/lib64/apache2/ | compiled libraries |
/usr/lib64/apache2/modules | compiled modules |
/usr/sbin | binary files |
/usr/share | documentation, manual |
/usr/share/man | pages, examples |
/var/log/apache2 | logs |
/var/www | web pages (resources) |
/var | in subdirectories more files, locks, … |
/etc/apache2/ | globální konfigurace |
/etc/apache2/mods-available | konfigurace modulů |
/etc/apache2/sites-available | konfigurace virtuálních hostitelů |
/etc/apache2/conf-available | rozšiřující konfigurace |
/usr/lib64/apache2/ | zkompilované knihovny |
/usr/lib64/apache2/modules | zkompilované moduly |
/usr/sbin | binární soubory |
/usr/share | dokumentace, manuálové |
/usr/share/man | stránky, příklady |
/var/log/apache2 | logy |
/var/www | webové stránky |
/var | v dalších podadresářích další soubory, zámky … |
/etc/httpd/ | global configuration |
/etc/httpd/conf.d | parts of server configuration |
/etc/sysconfig/httpd | server start configuration |
/usr/lib/httpd/modules | compiled modules |
/usr/sbin | binary files |
/usr/share/doc/httpd-2 … | documentation |
/usr/share/man | manual pages |
/var/log/httpd | logs |
/var/www | web pages (resources) |
/etc/httpd/ | globální konfigurace |
/etc/httpd/conf.d | dílčí konfigurace serveru |
/etc/sysconfig/httpd | konfigurace startu serveru |
/usr/lib/httpd/modules | zkompilované moduly |
/usr/sbin | binární soubory |
/usr/share/doc/httpd-2 … | dokumentace |
/usr/share/man | manuálové stránky |
/var/log/httpd | logy |
/var/www | webové stránky |
All files are placed into /usr/local
in case of compilation and standard installation (unless another layout is chosen during configuration) For easy uninstallation
V případě instalace do /usr/local
jsou všechny součásti webserveru umístěny do jeho podadresářů snadnější odinstalace
apachectl
wrapper
Manuální ovládání pomocí wrapperu apachectl
apachectl [-k] start -D DEF...
apachectl [-k] stop
apachectl [-k] test
apachectl -t
apachectl -t -D INFO ...
tail -f /usr/local/apache2/logs{error,access}_log
apachectl …
commands
In case of webserver incorporation into standard server infrastructure
Automatické ovládání Init skripty volání příkazu apachectl …
V případě začlenění webserveru do infrastruktury serveru
Signal | Action | -k |
---|---|---|
Signál | Akce | -k |
TERM | stop now | stop |
USR1 | graceful restart | graceful |
HUP | restart now | restart |
WINCH | graceful stop | graceful-stop |
apachectl
is just a script calling httpd
program
apachectl
je pouze skript volající program httpd
file -b /usr/local/apache2/bin/apachectl
POSIX shell script, ASCII text executable
httpd
program
Skript předává své argumenty programu httpd
grep HTTPD /usr/local/apache2/bin/apachectl
HTTPD='/usr/local/apache2/bin/httpd'
$HTTPD -k $ARGV
$HTTPD -t
$HTTPD $ARGV
file -b /usr/local/apache2/bin/httpd
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, …
apachectl -f /usr/local/apache2/conf/httpd.conf
apachectl -l
apachectl -M
man apachectl
man apache2
/usr/local/apache2
V případě kompilace a instalace do /usr/local/apache2
man /usr/local/apache2/man/man8/apachectl.8
man /usr/local/apache2/man/man8/httpd.8
export MANPATH=$MANPATH:/usr/local/apache2/man
man apachectl
man httpd
The goal is to download and compile webserver from source code, to start and test running webserver. The small changes in configuration files to enable local web documentation are parts of that task.
Cílem je stažení a kompilace ze zdrojových kódů, spuštění serveru a jeho otestování. Součástí úlohy je také úprava konfigurace a zpřístupnění lokální webové dokumentace.
apr
and apr-util
source codes are needed to be downloaded otherwiseINSTALL
file inside Apache httpd source codesapr
a apr-util
INSTALL
zdrojových kódů ApacheAnother Apache httpd server is already installed using package manager at this system. That's why is important to call newly compiled programs within pathname!
V systému je nainstalovaný ještě Apache z balíčkovacího systému, proto je potřeba volat programy zkompilovaného Apache včetně cesty!
sha256sum -c *.sha256
tar xzf httpd*.gz
./configure && make && make install
/usr/local/apache2/bin/apachectl start
telnet localhost 80
GET / HTTP/1.0
netstat -tapln
pgrep -l httpd
/usr/local/apache2/bin/apachectl -l
/usr/local/apache2/bin/apachectl -M
The status module is being loaded but info module is not
Je načítán modul status a není načítán modul info
lsof -i :80
lsof -i :http
curl
usage
Použití příkazu curl
# prints out response body (GET method)
curl URI
# prints out head and body of response (GET method)
curl -i URI
# prints out only head of response (HEAD method)
curl -I URI
wget
usage
Použití příkazu wget
# saves reponse body into file
wget URL
# prints out response body
wget -O - URL
# prints out response body to stdout and response head to stderr
wget -S -O - URL
/\c
textset ignorecase
set ignorecase
into vim configuration file ~/.vimrc
/\c
textset ignorecase
set ignorecase
do souboru ~/.vimrc
mod_status
) configuration
Uncomment line:
Include conf/extra/httpd-info.conf
in /usr/local/apache2/conf/httpd.conf
file
Konfigurace status modulu (mod_status
) - Načtení konfigurace
Odkomentujte řádky:
Include conf/extra/httpd-info.conf
v souboru /usr/local/apache2/conf/httpd.conf
vi /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/bin/apachectl -M | grep info
mod_status
Edit line: Require host …
in /usr/local/apache2/conf/extra/httpd-info.conf
file
Povolení přístupu k informacím z mod_status
Modifikace řádky Require host …
v souboru /usr/local/apache2/conf/extra/httpd-info.conf
vi /usr/local/apache2/conf/extra/httpd-info.conf
Require host .example.com → Require host localhost
/usr/local/apache2/bin/apachectl restart
LoadModule
)
Odkomentovat načtení modulu info (LoadModule
)
vi /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/bin/apachectl restart
Include conf/extra/httpd-manual.conf
in /usr/local/apache2/conf/httpd.conf
file
Zpřístupnění lokální webové dokumentace
Odkomentování řádky Include conf/extra/httpd-manual.conf
v souboru /usr/local/apache2/conf/httpd.conf
vi /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/bin/apachectl restart
LanguagePriority
LoadModule …
LanguagePriority
LoadModule …