Apache


Tags:

I was recently setting up a site hosted by bluehost and running drupal.

Before you transfer DNS authority to bluehost, they give you a temporary URL to allow you to get the site up and running and tested before you make it live. The URL is in this format:

http:<IP>/~<username>
or
http://69.89.31.189/~camelrch

I installed Drupal using 'fantastico', which is available from the bluehost control panel. But to get Drupal to recognize this 'test' URL, you have to change two things.


Tags:

For security, you might wish to turn off the directory browsing capability on your Apache server. By doing so, you prevent users from browsing the directory structure in your web docs.

My basic httpd.conf had this entry:

<Directory "/u01/app/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

which allows the user to browse the directory structure.

to turn directory browsing off, I added a "-" in front of Indexes after Options.


Tags:

In httpd.conf

ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /roller/ http://hostname:8080/roller/
ProxyPassReverse /roller/ http://hostname:8080/roller/
ProxyPass /roller http://hostname:8080/
ProxyPassReverse /roller http://hostname:8080/



Tags:

I compiled 2 different versions of apache 2.2.4 on Solaris 10 (06/06, on a crappy U10, but...) one using the prefork MPM (compile --with-mpm=prefork) and the other using the worker MPM (compile --with-mpm=worker). Prefork is supposed to generally be better for single or dual cpu systems, and worker is supposed to be generally better for multi-CPU systems. The following are the Apache Bench results run against each build on an old Sun Ultra 10 with a single 440mhz CPU and 512m RAM. The server isn't impressive, but it works for bench-testing the MPMs...


Tags:
Password Protecting a file or directory in Apache
************************************************************************



changes to the httpd.conf file:
-------------------------------

Default: This disables the processing of .htaccess files for the system.

         <Directory />
         AllowOverride None
         </Directory>

or for a specified directory:

         <Directory /home/domain/public_html>
         AllowOverride None
         </Directory>

Change to and/or specify directory to protect:


Tags:
in httpd.conf:


### Section 3: Virtual Hosts

#
# Use name-based virtual hosting.
#

NameVirtualHost 192.168.1.122
Listen 192.168.1.122:80

#
# VirtualHost example:
#

<VirtualHost 192.168.1.122>
    ServerName www.domain1.org
    DocumentRoot /usr/local/apache2/domain1.org/htdocs
    ServerAdmin admin@domain1.org
    ErrorLog logs/domain1.error_log
    CustomLog logs/domain1.access_log combined
</VirtualHost>

<VirtualHost 192.168.1.122>
    ServerName www.domain2.net
    DocumentRoot /usr/local/apache2/domain2.net/htdocs

Tags:

in httpd.conf, add:

CustomLog "|/u01/app/apache/bin/rotatelogs /u01/app/apache/logs/access_log.%Y%m%d 86400 -360" common

(changing the path as needed...)
where the number 86400 is seconds to rotation (86400 is 24 hours)
and -360 is minutes offset from UTC 0 (-360 is for US Central)

and comment out any other line beginning with 'CustomLog'

this will give you logs, rotated daily, named something like:

access_log.20061101
access_log.20061102
access_log.20061103

...so you don't have to stop the server to deal with gigantic log files... 



Tags:

common Apache httpd command line options

httpd -l                # shows which modules were compiled into Apache
httpd -V                # shows compile settings
httpd -v                # shows version number
httpd -t                # verifies syntax for config files 
httpd -h                # lists available option (help)
httpd -M                # lists loaded modules