Gandi AI Tutorials

CMS

E-Commerce

Groupware

Subversion

Programming

Quit Gandi AI to install a SSL virtualhost on Apache2

You will have to use another MPM (Apache connections manager) than PerUser which is used by default in Gandi AI, PerUser can not yet support SSL.

I suggest you to use the Prefork MPM which is the one by default in Apache2, type the following command in order to do this : aptitude (or apt-get) install apache2-mpm-prefork.

You will have to adapt the rights/permissions of the documentroot of your virtualhost regarding the Apache configuration.

Create a virtualhost and an FTP user after quitting Gandi AI (if you always use PerUser)

Log in on your VPS using SSH and the 'admin' system user, then type the “su -” command (”-” allows to use the root environnement variables for information).

Go in the virtualhosts configuration folder :

cd /etc/apache2/sites-available/

Copy a virtualhost :

cp 000-www.example.net 001-www.domain.tld

Modif it using your prefered editor:

nano/emacs/vim/... 001-www.domain.tld

Configure the necessary options:

<VirtualHost *:80>
	ServerName 	www.domain.tld
	ServerAlias     domain.tld
	ServerAdmin	webmaster@domain.tld

	DocumentRoot "/srv/d_data/www/www.domain.tld/htdocs"
    <Directory "/srv/d_data/www/www.domain.tld/htdocs">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /srv/d_data/www/www.domain.tld/cgi-bin/
    <Directory "/srv/d_data/www/www.domain.tld/cgi-bin/">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /srv/d_data/www/www.domain.tld/logs/www.domain.tld-error.log
    LogLevel error
    SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
    CustomLog /srv/d_data/www/www.domain.tld/logs/www.domain.tld-access.log combined env=!loopback
    ServerSignature On

    <IfModule mod_dav.c>
        DAVLockDB /srv/d_data/www/www.domain.tld/db/DAVLock
    </IfModule>

    <IfModule mpm_peruser_module>
        ServerEnvironment userftp_www-userftp
        MaxProcessors 20
    </IfModule>

    Include /etc/apache2/sites-includes/www.domain.tld/
</VirtualHost>

Create folders & files needed for this vhost :

mkdir /etc/apache2/sites-includes/www.domain.tld/

mkdir /srv/d_data/www/www.domain.tld/
mkdir /srv/d_data/www/www.domain.tld/htdocs/
mkdir /srv/d_data/www/www.domain.tld/logs/
mkdir /srv/d_data/www/www.domain.tld/db/
mkdir /srv/d_data/www/www.domain.tld/cgi-bin/

touch /srv/d_data/www/www.domain.tld/logs/www.domain.tld-access.log
touch /srv/d_data/www/www.domain.tld/logs/www.domain.tld-error.log

Then the FTP user and its group :

adduser userftp
addgroup www-userftp
adduser admin www-userftp
adduser userftp www-userftp
adduser www-data www-userftp

Give rights on folders & files to the FTP user :

chown -R userftp:www-userftp /srv/d_data/www/www.domain.tld/

Modify the root folder for the FTP user and its default shell :

userftp:x:1002:1002::/srv/d_data/www/www.domain.tld/:/bin/false

Activate the vhost & restart Apache :

a2ensite 001-www.domain.tld
/etc/init.d/apache2 restart
Last modified: 10/22/2012 at 16:21 by Ryan A. (Gandi)