Apache Web Server
Apache Web Server (also known as Apache HTTP Server) is the world's most popular (by volume, deployment/use) web server software platform.
Apache Web Server is definitely the Apache foundation's single most successful (top most downloaded software - #10[1], most used web server - 60.31%[2]) project to date, and is the crown jewel of the foundation's work, enabling millions to publish their works on the World Wide Web.
Contents
Specifications
.htaccess
.htaccess is the name of a configuration file Apache Web Server looks for to route HTTP requests to a given sub-domain or folder on the server. It is most commonly used in unison with a URL pattern module such as mod_rewrite[3] and/or mod_seo[4].
Installation
- Apache Installation Guide: http://httpd.apache.org/docs/2.2/install.html
XAMPP
Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.
A new version of XAMPP was recently released, including:
* Apache HTTPD 2.2.11 + Openssl 0.9.8i * MySQL 5.1.30 * PHP 5.2.8 * phpMyAdmin 3.1.1 * FileZilla FTP Server 0.9.29 * Mercury Mail Transport System 4.52
- XAMPP Project: http://www.apachefriends.org/en/xampp.html
- XAMPP For Windows: http://www.apachefriends.org/en/xampp-windows.html#641
- Can't open/access XAMPP Security Console (1.7.0): http://www.apachefriends.org/f/viewtopic.php?f=16&t=32690
- Use XAMPP Security Script to Password Protect /xampp and phpMyAdmin root User: http://robsnotebook.com/xampp-builtin-security (since the Security "quickstart" Console/page seems to have been removed, this outlines the steps that it scripted)
Windows VISTA (peculiarities)
- Installing Apache on Vista: http://www.simonwhatley.co.uk/installing-apache-on-vista
- Installing PHP with Apache on Windows Vista: http://www.simonwhatley.co.uk/installing-php-with-apache-on-windows-vista
- Configuring PHP with Apache on Windows Vista: http://www.simonwhatley.co.uk/configuring-php-with-apache-on-windows-vista
WAMP
One possible solution to the many reported Windows problems, is to use a distribution of Apache Web Server optimized for installation and usage on Windows OS to begin with, which is the proposal of Windows Apache MySQL Php (WAMP) server.
- WAMP server: http://www.wampserver.com[6]
- WIMP: (replaces Apache with IIS)[7][8]
MAMP
When it comes to running a web server on a Mac, the best option is either the built-in (yet limited) local server distributions[9] or a full-blown Apache Web Server installation via MAMP.
- Mac OS, Apache, MySQL, PHP/Python/Perl (MAMP): http://www.mamp.info/en/[10]
- CODA: http://www.panic.com/coda/ (develop in the browser, not on local filesystem)
LAMP
The traditional open source platform is still the powerful and robust combination of Linux (), Apache Web Server, MySQL RDBMS and PHP[11].
- Linux, Apache, MySQL, PHP/Python/Perl (LAMP): http://lamphowto.com/[12]
APISIX
- APISIX: https://apisix.apache.org/ | DOCS | SRC | DOWNLOADS (effortless & smooth API Traffic management)
- APISIX - an API Gateway the Apache way: https://blog.frankel.ch/apisix-api-gateway/
Modules
Apache Web Server includes a highly customizable extension mechanism known as "modules" (commonly abbreviated as a mod). All module libraries are typically prefixed by mod_ such as the most popular ones:
- mod_rewrite - URL re-writing capabilities (to re-route requests to one place over to another to determine appropriate response)
- mod_ldap - ActiveDirectory and/or OpenLDAP integrations
- mod_proxy - setup a Forward Proxy or Reverse Proxy
- mod_security - Web Application Firewall (WAF)
- mod_ssl - Apache interface to OpenSSL
- mod_geoip - looks up the IP address of the client end user, which can then be used to perform redirection based on country.
- mod_torcheck - blocks requests from Tor exit nodes
- mod_cgi - allows usage of CGI scripts in your web server
- mod_php - allows usage of PHP scripts in your web server
- mod_perl - allows usage of Perl scripts in your web server
- mod_python - allows usage of Python scripts in your web server
- mod_aspdotnet - allows usage of ASP.net/C# scripts in your web server
- mod_pagespeed - Google authored module to rewrite web pages to reduce latency & bandwidth
- mod_upload - file upload convenience methods & security helpers
- mod_xml - enables native XML functions to gain some parsing/serializing performance optimizations over custom scripts
- mod_xslt - enables native transformation of XML formatted documents to other formats via XSL
- mod_xmlrpc - enables native use of XML-RPC
- mod_flvx - stream Flash videos
- Apache Web Server -- Module index: https://httpd.apache.org/docs/2.4/mod/
- wikipedia: List of Apache modules
Dispatcher
See AEM Dispatcher
Re-Write Rules for Web Server
Using Re-Write rules requires the mod_rewrite to be properly configured within your Apache Web Server distribution.
For example, the following mod_rewrite rules can be applied to shorten:
http://bcmoney-mobiletv.com/api/foaf/FoafWriter.php?u=bryan
|
INTO
|
http://bcmoney-mobiletv.com/bryan/foaf/
RewriteEngine on RewriteRule ^([^/\.]+)/foaf/?$ api/foaf/FoafWriter.php?u=$1 [L]
Where:
- ^ means match anything before this point
- ([^/\.]+) means match one or more characters that aren’t a forward slash or a period
- /?$ means ensure the only thing that is found after what was just matched is a possible forward slash, and nothing else. (If anything else is found, then this RewriteRule will be ignored.)
- FoafWriter.php is the actual page to load
- ?u= is the URL (GET) query parameters
- $1 is the value captured by mod_rewrite for passing to the page (in the example's case, the username bryan)
[17] [18] [19] [20] [21] [22] [23] [24] [25]
Tools
- Basic .htaccess code syntax checker and validator : http://www.lyxx.com/freestuff/002.html
- Hotlink Protection Tester: http://www.htaccesstools.com/test-hotlink-protection/
- Apache mod_rewrite rule debugger: http://martinmelin.se/rewrite-rule-tester/
Resources
- Apache Modules: http://httpd.apache.org/docs/2.0/mod/
- URL Rewriting Guide: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
- mod_rewrite (CHEAT SHEET): https://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/
- THE Ultimate .htaccess: http://www.askapache.com/htaccess/htaccess.html
- Last Modified Header vs Expire Header vs eTag: http://www.xpertdeveloper.com/2011/03/last-modified-header-vs-expire-header-vs-etag/[26]
Tutorials
- Installing Apache on Fedora (or CentOS): https://articles.slicehost.com/2010/5/20/installing-apache-on-fedora
- How to Install and Configure Apache as a Web Server on Ubuntu 16.04+: https://medium.com/swlh/how-to-install-and-configure-apache-as-a-web-server-on-ubuntu-16-04-77fa7f57dea2
- How to install and start the Apache or httpd service under Linux: http://www.cyberciti.biz/faq/linux-install-and-start-apache-httpd/
- Apple Communities -- Setting up a local web server on a Mac: https://discussions.apple.com/docs/DOC-3083 (subtle differences per OS version)
- Start / Stop and Restart Apache 2 Web Server Command: https://www.cyberciti.biz/faq/star-stop-restart-apache2-webserver/
- How To Check the Version of Apache: https://www.liquidweb.com/kb/how-to-check-the-version-of-apache/
- Apache Tutorial -- Dynamic Content with CGI: http://httpd.apache.org/docs/2.2/howto/cgi.html
- Writing Apache Modules: http://drdobbs.com/architecture-and-design/184405150
- Lost httpd.conf file located apache: https://stackoverflow.com/questions/12202021/lost-httpd-conf-file-located-apache
- .htaccess tutorial: http://httpd.apache.org/docs/2.2/howto/htaccess.html (official)
- Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to Ask: https://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever
- Stupid (simple) .htaccess Tricks: https://perishablepress.com/stupid-htaccess-tricks/
- .htaccess tips and tricks - redirecting and rewriting: http://corz.org/serv/tricks/htaccess2.php?page=all
- .htaccess: http://www.javascriptkit.com/howto/htaccess9.shtml
- Apache .htaccess Tweaking Tutorial (HOW to BLOCK web bots / spiders): http://vortexmind.net/2006-02-26-apache-htaccess-tweaking-tutorial/
- An In Depth Guide to mod_rewrite for Apache: http://net.tutsplus.com/tutorials/other/a-deeper-look-at-mod_rewrite-for-apache/
- Learn Apache mod_rewrite from 13 Real-world Examples: http://articles.sitepoint.com/article/apache-mod_rewrite-examples/2
- mod_rewrite, a beginner’s guide (with examples): http://www.workingwith.me.uk/articles/scripting/mod_rewrite
- mod rewrite - conditions: http://center.uniformserver.com/new_users_mod_rewrite/mod_rewrite_6_condition.html
- Use Apache's mod_rewrite to make URLs more user friendly: http://articles.techrepublic.com.com/5100-10878_11-5068743.html
- Using .htaccess Files for Pretty (and SHORT) URLs: http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/ (URL shortener complete tutorial)
- How to install an Intermediate CA cert in Apache?: https://access.redhat.com/solutions/43575 (fix server-side SSL/HTTPS certificate problems)
- Speed up your site by compressing and caching your content with .htaccess: http://www.samaxes.com/2009/01/more-on-compressing-and-caching-your-site-with-htaccess/
- Add Cache-Control Headers: http://www.askapache.com/htaccess/apache-speed-cache-control.html
- Speed Tips - Add Future Expires Headers: http://www.askapache.com/htaccess/apache-speed-expires.html
- YSlow and Compress Components with GZip: http://pixeljar.net/2009/06/06/how-to-gzip-your-site-components/
- Add "expires" headers via META tags (which clients/bots should listen to when retrieving content): http://www.ehow.com/how_7291063_add-expired-headers.html
- How to Compress PHP and Other Text-Based Files with 1&1 (and other Shared Hosts that don't allow/support GZIP or mod_deflate): http://mrrena.blogspot.com/2009/01/how-to-compress-php-and-other-text.html
- Use XAMPP Security Script to Password Protect /xampp and phpMyAdmin root User: http://robsnotebook.com/xampp-builtin-security
- Adding MIME types to .htaccess (swf, html, vrml): http://www.htaccess-guide.com/index.php?a=11
- An introduction to services, runlevels, and rc.d scripts: http://www.linux.com/news/enterprise/systems-management/8116-an-introduction-to-services-runlevels-and-rcd-scripts
- Setting up wildcard DNS for subdomains: http://www.wiredstudios.com/php-programming/setting-up-wildcard-dns-for-subdomains-on-cpanel.html
- How To Fix a Missing Referrer-Policy on a Website: https://www.blackhillsinfosec.com/fix-missing-referrer-policy-website/[34][35]
- A new security header -- Referrer Policy: https://scotthelme.co.uk/a-new-security-header-referrer-policy/
- Set referrer header using query string on apache configuration: https://stackoverflow.com/questions/20220059/set-referrer-header-using-query-string-on-apache-configuration
- HTTP Referer based redirects in Apache: https://opensourcehacker.com/2011/09/19/http-referer-based-redirects-in-apache/
- Apache HTTP Server Version 2.2 -- Using mod_rewrite to control access: https://httpd.apache.org/docs/2.2/rewrite/access.html#referer-deflector[36][37]
- Expressions in Apache HTTP Server -- EXAMPLES: http://httpd.apache.org/docs/2.4/expr.html#examples[38][39]
- Apache -- Environment Variables Visibility with SetEnv, SetEnvIf and RewriteRule Directives: http://www.onlinesmartketer.com/2010/05/27/apache-environment-variables-visibility-with-setenv-setenvif-and-rewriterule-directives/
- Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to Ask: https://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever
- URL Rewriting for Beginners: https://aloneonahill.com/blog/url-rewriting-for-beginners/[40][41]
- HTTP/2 guide in Apache Web Server: https://httpd.apache.org/docs/2.4/howto/http2.html
- How to Enable HTTP/2 in Apache Web Server: https://www.howtoforge.com/how-to-enable-http-2-in-apache/
- How to Install and Configure Apache2: https://dzone.com/articles/how-to-install-and-configure-apache2
- HTTP/2 with Apache: https://http2.co/http2-with-apache/[42]
External Links
- wikipedia: Apache Web Server
- The Apache Software Foundation: http://apache.org/
- Apache Web Server: http://httpd.apache.org/
- Apache guide: http://www.apache.com/
- ApacheCon US 2009: http://streaming.linux-magazin.de/en/progam-apachecon-us-2009.htm
- Apache web server hit a home run in 2010: http://royal.pingdom.com/2011/01/04/apache-web-server-hit-a-home-run-in-2010/
- Apache Mod_Deflate and Flash SWF Files Don’t Like Each Other: http://www.philchen.com/2009/08/04/apache-mod_deflate-and-flash-swf-files-dont-like-each-other
- SetEnvIfNoCase Referer help: http://www.webmasterworld.com/forum92/5900.htm
- htaccess mod rewrite guide: http://www.blogstorm.co.uk/htaccess-mod_rewrite-ultimate-guide/
- Dynamic URLs vs. static URLs: http://googlewebmastercentral.blogspot.com/2008/09/dynamic-urls-vs-static-urls.html
- URL Rewriting for PHP Web Applications Using Apache mod_rewrite extension: http://www.techiepark.com/tutorials/url-rewriting-for-php-web-applications-using-apache-mod_rewrite-extension/
- Setting up an Apache web server - Permissions: http://www.royhochstenbach.com/setting-up-an-apache-web-server-permissions/
- Reduce TIME_WAIT socket connections: http://www.linuxbrigade.com/reduce-time_wait-socket-connections/
- TIME_WAIT and its design implications for protocols and scalable client server systems: http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html
- Web server performance comparison: https://help.dreamhost.com/hc/en-us/articles/215945987-Web-server-performance-comparison
- mod_macro -- Conditions in Apache: https://stackoverflow.com/questions/6343621/conditions-in-apache/6346407#6346407
- mod_define -- Variable Definition For Arbitrary Directives: https://people.apache.org/~rjung/mod_define/mod_define.html
- Environment Variables in Apache: https://httpd.apache.org/docs/2.4/env.html
- Using variables in Apache config files to reduce duplication?: https://serverfault.com/questions/64656/using-variables-in-apache-config-files-to-reduce-duplication
- httpd -- Could not reliably determine the server's Fully Qualified Domain Name (FQDN), using 127.0.0.1 for ServerName: https://stackoverflow.com/questions/9541460/httpd-could-not-reliably-determine-the-servers-fully-qualified-domain-name-us
- Threat Advisory - Apache HTTP Server zero-day vulnerability opens door for attackers : https://blog.talosintelligence.com/2021/10/apache-vuln-threat-advisory.html
References
- ↑ http://www.infoworld.com/d/open-source/top-10-open-source-hall-famers-848¤t=11&last=1#slideshowTop
- ↑ April 2011 Web Server Survey: http://news.netcraft.com/archives/category/web-server-survey/
- ↑ Mod_Rewrite ‘How To’ tutorial: http://www.rankinglabs.com/Mod_Rewrite
- ↑ Keyword reach URLs in 5 minutes: http://www.helicontech.com/articles/mod_seo/
- ↑ Is there way to use two PHP versions in XAMPP?: https://stackoverflow.com/questions/45790160/is-there-way-to-use-two-php-versions-in-xampp
- ↑ wikipedia: WAMP
- ↑ wikipedia: WIMP (software bundle)
- ↑ How To Install Perl on a WAMP Server: http://webdevster.com/how-to/install-perl-on-wamp
- ↑ How to Turn Your Mac Into a Web Server: http:///www.macinstruct.com/node/112
- ↑ wikipedia: MAMP
- ↑ LAMP - The Open Source Web Platform: http://onlamp.com/pub/a/onlamp/2001/01/25/lamp.html
- ↑ wikipedia: LAMP (software bundle)
- ↑ Apache APISIX - Software Architecture diagram: https://apisix.apache.org/docs/apisix/architecture-design/apisix/
- ↑ "start-apisix" Java/Apache API Gateway example: https://github.com/ajavageek/start-apisix
- ↑ Apache hardening - 10 Tips to Secure Your Apache Web Server on UNIX / Linux: https://www.thegeekstuff.com/2011/03/apache-hardening/
- ↑ Commonly Used Apache Moduleshttps://www.: interserver.net/tips/kb/commonly-used-apache-modules/
- ↑ mod_rewrite docs: http://httpd.apache.org/docs/current/rewrite/
- ↑ Getting .htaccess mod_rewrite rules working locally with XAMPP: http://www.web-design-talk.co.uk/126/getting-htaccess-mod-rewrite-working-locally-with-xampp/
- ↑ How to enable rewrite module in XAMPP, WAMP and Apache: http://www.anmsaiful.net/blog/php/enable-apache-rewrite-module.html
- ↑ AllowOverride explained: http://vr-zone.com/manual/en/mod/core.html#allowoverride
- ↑ URL Rewriting for Beginners (with plenty of examples): https://www.addedbytes.com/blog/url-rewriting-for-beginners/
- ↑ wikipedia: mod_proxy
- ↑ An In-Depth Guide to mod_rewrite for Apache: https://code.tutsplus.com/tutorials/an-in-depth-guide-to-mod_rewrite-for-apache--net-6708
- ↑ mod_rewrite, a beginner’s guide (with examples): http://www.workingwith.me.uk/articles/scripting/mod_rewrite
- ↑ Apache mod_rewrite and Examples: https://www.hostgator.com/help/article/apache-mod-rewrite-and-examples
- ↑ Speed Tips - Remove Last-Modified and ETag Headers (when using "Expires" header instead): http://www.askapache.com/htaccess/apache-speed-last-modified.html
- ↑ Where are the Apache Configuration files on Mac? – httpd.conf: https://smartwebdeveloper.com/mac/httpd-conf-location-mac
- ↑ Installing Apache, PHP, and MySQL on macOS Catalina: https://jasonmccreary.me/articles/install-apache-php-mysql-mac-os-x-catalina/
- ↑ How to Install Apache Web Server, PHP, Perl on Mac OS X Yosemite: https://crunchify.com/how-to-install-apache-web-server-on-mac-os-x-yosemite/
- ↑ Setting up an apache web server on mac os Sierra (macbook pro 13 2014): https://stackoverflow.com/questions/39757902/setting-up-an-apache-web-server-on-mac-os-sierra-macbook-pro-13-2014
- ↑ pls help to rewrite subdomains to subfolders: http://www.webmasterworld.com/apache/3163397.htm
- ↑ http://stackoverflow.com/questions/6725973/rewrite-folder-to-subdomain-with-htaccess
- ↑ http://stackoverflow.com/questions/49500/apache-rewrite-based-on-subdomain
- ↑ How can I add in apache referrer policy header?: https://serverfault.com/questions/880894/how-can-i-add-in-apache-referrer-policy-header
- ↑ How To Fix a Missing Content-Security-Policy on a Website: https://www.blackhillsinfosec.com/fix-missing-content-security-policy-website/
- ↑ Is it possible to set headers conditionally?: https://stackoverflow.com/questions/16074750/is-it-possible-to-set-headers-conditionally
- ↑ Set Apache headers conditionally: https://stackoverflow.com/questions/21270902/set-apache-headers-conditionally
- ↑ Apache X-Frame-Options Allow-From multiple domains: https://stackoverflow.com/questions/38744953/apache-x-frame-options-allow-from-multiple-domains
- ↑ X-Frame-Options -- ALLOW-FROM in firefox and chrome: https://stackoverflow.com/questions/10658435/x-frame-options-allow-from-in-firefox-and-chrome
- ↑ Apache mod_alias RedirectMatch everything except specific pattern: https://stackoverflow.com/questions/26399826/apache-mod-alias-redirectmatch-everything-except-specific-pattern
- ↑ Rewrite URLs with mod_rewrite and Apache: https://www.linode.com/docs/web-servers/apache-tips-and-tricks/rewrite-urls-with-modrewrite-and-apache/
- ↑ Site Performance Tip: Update to HTTP2: https://freestar.com/site-performance-tip-update-http2/
See Also
Apache | Tomcat | Web Server | Hotlinking | SEO | Security