Virtual hosts are used to run more than one web site on a single machine.
Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address.

I want to show you one of mine scripts for easy create virtual hosts in Debian Squeeze or ubuntu.

#!/bin/bash
VHOST_CONF=/etc/apache2/sites-enabled/
ROOT_UID=0
NOTROOT=87
WWW_ROOT=/var/www/

# Check if is root
if [ “$UID” -ne “$ROOT_UID” ]
then
echo “You must be root to run this script.”
exit $NOTROOT
fi

if [ -n “$1” ]
then
DOMAIN=$1
else
echo “You must provide a full domain name for this site, i.e. ‘example.com’ ”
echo -n “Run this script like ./script example.com .”
exit
fi

#Create document root site folder
mkdir -p $WWW_ROOT/$DOMAIN

Continue Reading…

On Debian systems … Apache comes with mod_status compiled by default.
mod_status provides information on the Apache server activity and performance.
This tutorial will show you how to enable this feature, so that only requested issued from localhost are accepted and served.

Setting mod_status up:

By default, server status report is commented so you can not access it. To enable it, you need to uncomment from /etc/apache2/apache2.conf:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .your_domain.com
</Location>

Continue Reading…

Mount ftp shares:

1. Install required packages

apt-get install curlftpfs

2. Create directory to mount the ftp site

mkdir /mnt/my-ftpsite

3. Add the curlftpfs mount into fstab to make it mount everytime the system is started (pico /etc/fstab)

curlftpfs#{username}:{password}@{host} /mnt/my-ftpsite fuse rw,allow_other,uid={userid} 0 0

4. Mount the ftp site Continue Reading…

You can give user based web pages in your apache based  server.

Follow the simple steps shown below after installing apache:

$ cd /etc/apache2/mods-enabled

$ sudo ln -s ../mods-available/userdir.conf userdir.conf

$ sudo ln -s ../mods-available/userdir.load userdir.load

$ sudo /etc/init.d/apache2 restart

and

make directory at your home folder named public_html as normal user($ mkdir public_html)

now browse with address

http://127.0.0.1/~username

Just put this in your ..htaccess file.

// .htaccess HTTP to HTTPS Rewrite Rule
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Page 7 of 9123456789