Pocket Theories

Apache

Sample Config

Updated: September 8, 2024


ServerRoot "/opt/homebrew/opt/httpd"
Listen 127.0.0.1:8080
ServerName MyMacWebServer

LoadModule mpm_prefork_module lib/httpd/modules/mod_mpm_prefork.so
LoadModule log_config_module lib/httpd/modules/mod_log_config.so
LoadModule unixd_module lib/httpd/modules/mod_unixd.so
LoadModule authz_core_module lib/httpd/modules/mod_authz_core.so

LoadModule mime_module lib/httpd/modules/mod_mime.so
AddType text/html .html

DocumentRoot "/Users/nitin/Documents/www/html/"
CustomLog "/Users/nitin/Documents/www/log/httpd_log" common
ErrorLog "/Users/nitin/Documents/www/log/httpd_err_log"

LoadModule proxy_module lib/httpd/modules/mod_proxy.so
LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so
LoadModule xml2enc_module lib/httpd/modules/mod_xml2enc.so
LoadModule proxy_html_module lib/httpd/modules/mod_proxy_html.so


ProxyPass "http://MyAppServer:8080"
#ProxyHTMLEnable On
#SetOutputFilter proxy-html



AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile "/usr/local/apache/passwd/passwords"
Require valid-user

	  
# Create (-c) the password file, (-b) password on cmdline
htpasswd -b -c /usr/local/apache/passwd/passwords nitin mypass
Also see: https://httpd.apache.org/docs/2.4/howto/auth.html

Digest Authentication

Updated: September 14, 2024


AuthType Digest
    
htdigest -c /usr/local/apache/passwd/passwords "The Realm" nitin