Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by jmcg: http://wiki.apache.org/httpd/BasicConfigExample The comment on the change is: Added a basic apache config which is to be documented for newbies. New page: Describe BasicConfigExample here.## APACHE 2.2.0 Config ## ## Server Settings ## ServerRoot "/etc/httpd" User apache Group apache ServerName "vhosts.example.com" ServerAdmin [EMAIL PROTECTED] UseCanonicalName Off HostnameLookups Off ## ## Timeouts and KeepAlives. ## Timeout 300 KeepAlive On KeepAliveTimeout 5 MaxKeepAliveRequests 100 ## ## Content Defaults. ## AccessFileName .htaccess DefaultType text/plain ## ## General modules. ## LoadModule dir_module modules/mod_dir.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule setenvif_module modules/mod_setenvif.so ## ## AutheNtication and AuthoriZation modules ## LoadModule authn_file_module modules/mod_authn_file.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule auth_basic_module modules/mod_auth_basic.so ## ## Load/Configure PHP support for all Directories. ## LoadModule php5_module modules/mod_php5.so AddHandler application/x-httpd-php php DirectoryIndex index.php index.html ## ## Basic SSL Setup ## LoadModule ssl_module modules/mod_ssl.so SSLPassPhraseDialog builtin AcceptMutex flock SSLSessionCache shmcb:/var/cache/httpd/mod_ssl/ssl_scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup /dev/urandom 256 SSLRandomSeed connect builtin ## ## CGI Support ## LoadModule cgi_module modules/mod_cgi.so ## ## Protect the / Directory (so you don't accidentally serve up your whole filesystem. ## <Directory /> Options None AllowOverride None Order deny,allow Deny from all </Directory> ## ## The following lines prevent .htaccess and .htpasswd files from being ## viewed by Web clients. ## <FilesMatch "^\.ht"> Order allow,deny Deny from all </FilesMatch> ## ## 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 LogFormat "%v %h %l %u %t \"%r\" %>s %b" common-vhost ErrorLog logs/error_log LogLevel warn ## ## Which IP Addresse(s) and Port(s) to Bind to. ## Listen 80, Listen *:80 and Listen 0.0.0.0:80 all bind Apache to every IP Address on your system ## Listen *:80 Listen *:443 ## ## NameVirtualHost tells Apache to use whatever "Host:" header the browser gives it as the ServerName. ## This means you can host more than one website on a single IP Address. ## NameVirtualHost *:80 ## ## A Sample VirtuaHost on Port 80 ## <VirtualHost *:80> ServerName "www.example.com" DocumentRoot "/var/www/example/html" CustomLog "logs/www.example.com/access.log" combined ErrorLog "logs/www.example.com/error.log" ScriptAlias /cgi-bin /var/www/www.example.com/cgi-bin <Directory /var/www/www.example.com/html> AllowOverride FileInfo Options +Indexes Order Allow,Deny Allow from all </Directory> <Directory /var/www/www.example.com/cgi-bin> AllowOverride None Options None Order Allow,Deny Allow from all </Directory <Directory /var/www/www.example.com/html/secure> AllowOverride FileInfo Options +Indexes ## ## Create /etc/httpd/conf/htpasswd with the following: ## # /usr/sbin/htpasswd -c /etc/httpd/conf/htpasswd <username> ## Remove the -c option to add extra users to it. ## AuthBasicAuthoritative On AuthType Basic AuthName "Login" AuthBasicProvider file AuthUserFile "/etc/httpd/conf/htpasswd" Require valid-user Order Allow,Deny Allow from all </Directory> </VirtualHost> ## ## VirtualHost for "www.another-example.com" ## <VirtualHost *:80> ServerName "www.another-example.com" DocumentRoot "/var/www/another-example/html" CustomLog "logs/www.another-example.com/access.log" combined ErrorLog "logs/www.another-example.com/error.log" <Directory /var/www/another-example/html> AllowOverride FileInfo Options +Indexes Order Allow,Deny Allow from all </Directory> </VirtualHost ## ## HTTPS (SSL) VirtualHost, with a HTTP -> HTTPS redirect. ## <VirtualHost *:80> ServerName "ssl.example.com" RedirectMatch permanent .* https://ssl.example.com/ </VirtualHost> <VirtualHost *:443> SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite "SSLv3:!ADH:!EXP:!LOW:!NULL" SSLCertificateFile /etc/ssl/ssl.example.com.crt SSLCertificateKeyFile /etc/ssl/ssl.example.com.key SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 <Files ~ "\.(cgi|shtml|phtml|php?)$"> SSLOptions +StdEnvVars </Files> ServerName "ssl.example.com" DocumentRoot "/var/www/ssl.example.com/html" CustomLog "logs/ssl.example.com/access.log" combined ErrorLog "logs/ssl.example.com/error.log" <Directory /var/www/ssl/html> AllowOverride none Options +Indexes Order Allow,Deny Allow from all </Directory> </VirtualHost>
