How to add preview and shared ssl for all domains

CrazyLane

Verified User
Joined
Dec 28, 2004
Messages
117
This will allow all domains to be share ssl and preview all domains instead of using ~username. This my first how to so please be kind. :)

All domains example:

https://sever.name.com/ssl/anydomain/
http://server.name.com/preview/anydomain

Instructions: Please backup any files!

cd /usr/local/directadmin/scripts/custom

pico -w domain_create_post.sh

Add this:

#!/bin/bash

ln -s /home/$username/domains/${domain}/public_html /home/sites/${domain}

Save it!

Then:

pico -w domain_destroy_post.sh

Add this:

#!/bin/bash

rm -f /home/sites/${domain}

Save it:

chown directadmin:directadmin *
chmod 700 domain*


Then edit your httpd.conf, yours may be diff. depending on your apache version,

pico -w /etc/httpd/conf/extra/httpd-vhosts.conf

Find:

<VirtualHost se.r.ver.ip:80>
ServerAdmin webmaster@localhost
AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2

Then Add this:

AliasMatch ^/preview/([^/]+)(/(.*))? /home/sites/$1/$3

Find:

<VirtualHost se.r.ver.ip:443>
ServerAdmin webmaster@localhost
AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2

Then Add this:

AliasMatch ^/ssl/([^/]+)(/(.*))? /home/sites/$1/$3

restart httpd

Now this will feature will be added to any added domains. To add this to a domain on the server just create the simlink replace the username and domain.com.

ln -s /home/username/domains/domain.com/public_html /home/sites/domain.com
 
Back
Top