Apache httpd
lastmod 2020-11-29created 2014-03-2039 edits
The Apache Web Server is an http web server maintained by the Apache Software Foundation. It runs not only on Unix-like systems such as BSD and Linux, but also on platforms such as Microsoft Windows and Novell NetWare.
Categories
- htpasswd & htaccess: ID & PW authentication using htaccess.
- Apache:Httpd:HowToInstall: Initial installation.
- Apache:Httpd:VirtualHost: Configuring virtual hosts.
- Apache:Httpd:LDAP: (mod_ldap) Integrating with LDAP.
- Apache:Httpd:WSGI: (mod_wsgi)
- Apache:Httpd:SSL: (mod_ssl): :Generating a private key with OpenSSL and enabling HTTPS.
- Svn:ApacheHttpd: Integrating SVN with Apache.
- Web cache
- Proxy server
Service port
To change the service port, edit the Listen entry in the /conf/httpd.conf file under the httpd root directory.
Checking module availability
With <IfModule>, you can check whether a module is in use (available).
Command line options
-
httpd -M - Dump a list of loaded Static and Shared Modules.
-
httpd -t - Uses the directives in the file config on startup.
-
apache2ctl -S - Get a list of all virtual hosts which are defined in all apache configuration files.
With OpenSSL
To install Apache together with OpenSSL, add --with-openssl to the configure options.
MAC OSX Commandline option
If installation fails on MAC OSX and the log message shows an error related to the x86_64 architecture, add the following options.
Enabling Apache HTTPS
On CentOS, mod_ssl is not included in the default packages. Install it as follows.
Ubuntu
Applying an SSL certificate for Apache HTTPS
Install OpenSSL, generate the certificate, then copy the files.
$ sudo apt-get install openssl
## ...
$ sudo cp server.crt /etc/ssl/certs
$ sudo cp server.key /etc/ssl/private
Apache HTTP 2.x configuration
Httpd-ssl.conf configuration
Edit it as follows.
<ifmodule ssl_module>
<VirtualHost _default_:443>
# General setup for the virtual host
...
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
Finally, restart Apache.
Troubleshooting
A collection of problems that can occur while using Apache httpd.
(13) Permission denied
On Unix-like OSes, only root can access well-known ports of 1024 or below. So run it with the root account.
Apache 2.4: 403 Status code
If you get a 403 Forbidden status code after updating to Apache 2.4.x, add Require all granted as shown below.
<Directory "your directory here">
Order allow,deny
Allow from all
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>
404 Not found
When using scripts such as php, accessing a path that does not exist as an actual directory can cause a 404 error. In this case, remove the Indexes option.
<VirtualHost _default_:443>
...
<Directory /var/www/html>
Options -Indexes
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Directory>
...
</VirtualHost>
AH00548
Testing the configuration file prints the following warning.
NameVirtualHost is going to be removed in the future. You can remove this directive.
Favorite site
- Apache httpd web site
- Wikipedia (en) Description of the Apache web server
- Get Apache, MySQL, PHP and phpMyAdmin working on OSX 10.9 Mavericks
- Apache user authentication (htpasswd,htaccess)
- [Recommended] Installing APM on CENTOS
- Superuser Korea Apache HTTPD manual 1
- Readhat: Chapter 3. The Apache HTTP Server
Log file management
- apache log management (logrotate, rotatelogs)
- apache log management (rotatelogs 9 o'clock rotate issue)
- Splitting Apache log files (access log, image log, warm log, mod_jk log)
- Apache log file management
- cronolog
Guide & Tip
- Preparing for web server traffic surges - (1) A case of tuning Apache + Tomcat settings
- Preparing for web server traffic surges - (2) APACHE vs. NGINX performance comparison
References
-
Www.superuser.co.kr.7z ↩