Apache HTTP Server

From wiki.vincentkong.com
(Redirected from Apache)
Jump to: navigation, search

Paper icon.png Related: http://www.vincentkong.com/tag/apache

Contents

Using htpasswd

Creating new file for user

$ htpasswd -c /path/to/passwordfile username

Add or change password for user

$ htpasswd /path/to/passwordfile username

Enable server status in Ubuntu

Enable mod_status module

$ sudo a2enmod status

Edit /etc/apache2/mods-enabled/status.conf

ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    AuthName "Server Status"
    AuthType Basic
    AuthUserFile /path/to/passwordfile
    Require valid-user
    Order deny,allow
    Allow from all
</Location>

Notepad icon.png Note: To allow only a specific user replace Require valid-user with Require user <username>

Enable mod_deflate in Ubuntu

The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network

To enable:

$ sudo a2enmod deflate

To enable manually, edit httpd.conf

LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so

<IfModule mod_deflate.c>
    # these are known to be safe with MSIE 6
    AddOutputFilterByType DEFLATE text/html text/plain text/xml

    # everything else may cause problems with MSIE 6
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
    AddOutputFilterByType DEFLATE application/rss+xml
</IfModule>

Running Apache with a different user/group

Edit httpd.conf

User username
Group groupname

In Ubuntu this is set in /etc/apache2/apache2.conf as:

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

where ${APACHE_RUN_USER} and ${APACHE_RUN_GROUP} is defined in /etc/apache2/envvars

Retrieved from "/wiki/Apache_HTTP_Server"
Personal tools
MY WEBSITES