Apache: _default_ VirtualHost overlap on port 443, the first has precedence

If you have just added another VirtualHost with SSL and Apache is giving to you this error:

[warn] _default_ VirtualHost overlap on port 443, the first has precedence

Probably you miss a

NameVirtualHost *:443

at the top of your httpd-vhosts.conf file.

Apache virtualhost: redirect a vhost from port 80 to 443 (ssl)

To redirect access to starndard www port to https one you’ve to change the default vhost configuration from VirtualHost *:80 to VirtualHost *:443 and add the “redirect section”:

I’ve added this:

<VirtualHost *:80>
ServerName example.twopenguins.it
ServerAlias www.example.twopenguins.it
<Location />
Redirect permanent / https://example.twopenguins.it
</Location>
</VirtualHost>

And changed the “old” section from :80 to :443:

<VirtualHost *:443>
ServerName example.twopenguins.it
ServerAlias www.example.twopenguins.it
SSLEngine on
ecc.. ecc..

Reload and you’re done.

FreeBSD: set up self-signed SSL certificates for Apache virtualhosts


cd /usr/local/etc/apache22/
openssl genrsa -des3 -out server.key 1024

(choose a password)

openssl req -new -x509 -days 3650 -nodes -sha256 -key server.key -out server.crt

answer the questions and you’re done.
Remove the password from the cert:

cp server.key server.key2
openssl rsa -in server.key2 -out server.key

Leggi tutto “FreeBSD: set up self-signed SSL certificates for Apache virtualhosts”

Debian lenny: switch Apache in a chroot environment

To do this i’ve followed an howto from unixlife.it with some modifications.
Assuming you have your websites on /var/www/ and you want to move it on a chroot dir, /var/chroot/apache/, for example, let’s see what do you need to do:
Remember to do a complete backup before doing anything that could be “dangerous”.

In /etc/apache2/apache2.conf add those lines:

ChrootDir /var/chroot/apache
LoadFile /lib/libgcc_s.so.1
LoadFile /lib/libnss_dns.so.2

The you’ve to create the directories for the chroot environment (a bit different from the unixlife article):

mkdir -p /var/chroot/apache/var/www
cd /var/chroot/apache
mkdir bin dev etc lib tmp usr var
mkdir bin lib sbin share
mkdir curl misc php zoneinfo
mount -t auto -o bind /usr/share/php /var/chroot/apache/usr/share/php
mount -t auto -o bind /var/www /var/chroot/apache/var/www
mount -t auto -o bind /tmp /var/chroot/apache/tmp/

Leggi tutto “Debian lenny: switch Apache in a chroot environment”