Home arrow Guides arrow Install mini_httpd in FreeBSD
Install mini_httpd in FreeBSD PDF
Thursday, 22 March 2012
mini_httpd is a very light http server. In same cases where you do not have many hits on your FreeBSD http server and you do not need all options Apache's got, but you rather want a light and small http server, mini_httpd could be your choise.

Install mini_httpd

To install mini_httpd from ports on our FreeBSD system run:

  cd /usr/ports/www/mini_httpd
  make install clean


Modify mini_httpd_wrapper to load config from /usr/local/etc

By default mini_httpd will look for a config file (called mini_httpd_config) in /usr/local/www. We think that is a bad idea, the config file should be located in /usr/local/etc like config files for all other FreeBSD usrland apps.

So we will edit mini_httpd_wrapper:

  edit /usr/local/sbin/mini_httpd_wrapper

and change line that contains:

  /usr/local/sbin/mini_httpd -D -C /usr/local/www/mini_httpd_config

to

  /usr/local/sbin/mini_httpd -D -C /usr/local/etc/mini_httpd.conf

You will notice we've also changed default name of mini_httpd config file (mini_httpd_config) into mini_httpd.conf which is more consistent with other config file names.


Create mini_httpd.conf file

We will edit /usr/local/etc/mini_httpd.conf file and add the following content:

/usr/local/etc/mini_httpd.conf # variant 1
port=8081
cgipat=**.cgi
user=root
data_dir=/home/user/public_html
logfile=/var/log/mini_httpd.log
pidfile=/var/run/mini_httpd.pid

This is the simplest config file.

Starting the http server

Then we start mini_http server:

  /usr/local/etc/rc.d/mini_httpd.sh start


Adding support for https

If we want to run and encrypted http server we will use the following config file

/usr/local/etc/mini_httpd.conf # variant 2, running via https
port=8081
cgipat=**.cgi
user=root
data_dir=/home/user/public_html
logfile=/var/log/mini_httpd.log
pidfile=/var/run/mini_httpd.pid
max_age=0
ssl
certfile=/usr/local/etc/mini_httpd.pem


Password protecting your /home/user/public_html

To password protect your home directory you will create a .htaccess file:

  cd /home/user/public_html
  htpasswd -c .htpasswd username


where username is your username you want to have when accessing the server.


Problems you might encounter

The start/stop script is not working properly. You might need to kill the mini_httpd and mini_httpd_wrapper processes. Also delete /var/run/mini_httpd.pid file.

Last Updated ( Thursday, 22 March 2012 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?