Apache: Difference between revisions
New page |
Original Apache wiki page |
||
| Line 1: | Line 1: | ||
Main documentation: http://httpd.apache.org/docs/ | Main documentation: http://httpd.apache.org/docs/ | ||
= ServerName and VirtualHosts = | |||
Apache can be configured to only serve one site, or to serve multiple sites. If multiple sites are to be served, VirtualHosts need to be set up. If it is only serving a single site, it may either use or not use a VirtualHost entry. If no such entry is used, ServerName needs to be the name of the site. If one or more VirtualHost entries are used, then ServerName (outside of the VirtualHost tags) may be completely different from the sites, i.e. the hostname may be used. | |||
= Check for a module = | |||
==CentOS== | |||
The '''httpd -l''' command doesn't always show everything. Grep for the module: | |||
grep -i module /etc/httpd/conf/httpd.conf | |||
==Debian/Ubuntu== | |||
<p>Only a very few will be listed with an '''apache2ctl -l''' command. Check /etc/apache2/mods-enabled and compare with /etc/apache2/mods-available.</p> | |||
<p>To load a module:</p> | |||
a2enmod moduleIwant | |||
<p>To unload a module:</p> | |||
a2dismod moduleIdonotwant | |||
Restart Apache to implement the change. | |||
=mod_rewrite= | |||
# Make sure it is compiled in. | |||
# Make sure it is turned on: RewriteEngine On | |||
# Add the line you want to rewrite. RewriteCond <whatever> | |||
# Add the instructions for what to do with it. RewriteRule <whatever> | |||
# Repeat RewriteRule for multiple RewriteCond statements. Close with L. May be able to use an OR after each RewriteCond instead of repeating the RewriteRule, I need to test this. | |||
More in: [[htaccess]] | |||
= PHP Handler = | |||
Remember to check for SuExec as well. | |||
== cPanel == | |||
/usr/local/cpanel/bin/rebuild_phpconf --current | |||
== Anything else == | |||
Check output of httpd -M or /etc/httpd/conf.d/php.conf | |||
Revision as of 04:26, January 15, 2021
Main documentation: http://httpd.apache.org/docs/
ServerName and VirtualHosts
Apache can be configured to only serve one site, or to serve multiple sites. If multiple sites are to be served, VirtualHosts need to be set up. If it is only serving a single site, it may either use or not use a VirtualHost entry. If no such entry is used, ServerName needs to be the name of the site. If one or more VirtualHost entries are used, then ServerName (outside of the VirtualHost tags) may be completely different from the sites, i.e. the hostname may be used.
Check for a module
CentOS
The httpd -l command doesn't always show everything. Grep for the module:
grep -i module /etc/httpd/conf/httpd.conf
Debian/Ubuntu
Only a very few will be listed with an apache2ctl -l command. Check /etc/apache2/mods-enabled and compare with /etc/apache2/mods-available.
To load a module:
a2enmod moduleIwant
To unload a module:
a2dismod moduleIdonotwant
Restart Apache to implement the change.
mod_rewrite
- Make sure it is compiled in.
- Make sure it is turned on: RewriteEngine On
- Add the line you want to rewrite. RewriteCond <whatever>
- Add the instructions for what to do with it. RewriteRule <whatever>
- Repeat RewriteRule for multiple RewriteCond statements. Close with L. May be able to use an OR after each RewriteCond instead of repeating the RewriteRule, I need to test this.
More in: htaccess
PHP Handler
Remember to check for SuExec as well.
cPanel
/usr/local/cpanel/bin/rebuild_phpconf --current
Anything else
Check output of httpd -M or /etc/httpd/conf.d/php.conf