Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
On RHEL, Apache runs as httpd.service; use systemctl to start, stop and reload it. apachectl configtest (= httpd -t) checks the syntax before you reload. httpd -S shows the virtual hosts as Apache understands them; httpd -M lists the loaded modules.
Zo schrijf je het
apachectl configtest | graceful | graceful-stop | start | stop | restart | fullstatus | status
httpd [-t] [-S] [-M] [-V] [-v] [-D NAME] [-f FILE] [-C DIRECTIVE]Belangrijkste delen
configtest- Check the configuration syntax (same as httpd -t).
graceful- Reload without dropping open connections (on RHEL: systemctl reload httpd).
start,stop,restart- On RHEL these call systemctl.
status,fullstatus- Status (fullstatus needs mod_status).
Opties 16
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Test the config
apachectl configtest Syntax OKAlways before a reload.
2Reload after a change
apachectl configtest && systemctl reload httpdOnly reloads when the syntax is OK.
3Show the virtual hosts
httpd -S VirtualHost configuration: *:80 is a NameVirtualHost default server www1.example.com (/etc/httpd/conf.d/sites.conf:5)Which vhost is the default and where it is defined.
4List modules
httpd -M | grep -E 'ssl|rewrite|headers'Is mod_ssl loaded?
5Version
httpd -vServer version and build date.
6Where are the config files?
httpd -t -D DUMP_INCLUDESAll included files in order.
7Status and logs
Errors at start or for requests.
8A 403 Forbidden? Check SELinux
Wrong labels are the most common reason.
9Hide version information (hardening)
printf 'ServerTokens Prod\nServerSignature Off\n' > /etc/httpd/conf.d/security.conf apachectl configtest && systemctl reload httpdHeaders show only "Apache".
10HTTPS
Adds ssl.conf with a test certificate on port 443.
Niets past bij dit filter.
Bestanden
/etc/httpd/conf/httpd.conf- Main config.
/etc/httpd/conf.d/- Extra configs and vhosts.
/etc/httpd/conf.modules.d/- Module loading.
/var/log/httpd/- Logs.
/var/www/html/- Default content.
Exitcodes
0 :: Done (syntax OK). 1 :: Error.