cd /usr/local/www/cp -Rp joomla john
cp -Rp joomla jennchown www:www johnchown www:www jenn
Now I have two seperate Joomla installations (it is advised to copy the original Joomla directory before starting your installation). Next is adding virtual hosts in the Apache config.
Uncomment the following line in /usr/local/etc/apache22/httpd.conf:
Include etc/apache22/extra/httpd-vhosts.conf
Edit /usr/local/etc/apache22/extra/httpd-vhosts.conf and add a comparable config like this (be sure to have your DNS-server support this otherwise use IP-adresses):
<VirtualHost *:80>Here's some info on virtual hosts from Apache.
ServerAdmin webmaster@yoursystem.local
DocumentRoot "/usr/local/www/john"
ServerName john.yoursystem.local
ServerAlias john
ErrorLog "/var/log/john-error_log"
CustomLog "/var/log/john-access_log" common
<Directory "/usr/local/www/john">
Order Allow,Deny
Allow From All
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@yoursystem.local
DocumentRoot "/usr/local/www/jenn"
ServerName jenn.yoursystem.local
ServerAlias jenn
ErrorLog "/var/log/jenn-error_log"
CustomLog "/var/log/jenn-access_log" common
<Directory "/usr/local/www/jenn">
Order Allow,Deny
Allow From All
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>
Before activating the second site decide if you want to create a new database or use the same database (if both are going to be busy sites, add a database per joomla installation).
SSL
Adding SSL to Apache does not automatically mean your Joomla site is reachable via HTTPS.Apache needs to be aware of vhosts which require ssl and of course we need certificates to encrypt our traffic.
Creating certficates:
The commands below create, sign and install certficates usable by Apache.
Update the apache config:cd ~mkdir -p certscd certsopenssl genrsa -des3 -out server.key 1024openssl req -new -key server.key -out server.csropenssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crtmkdir -p /usr/local/etc/apache22/ssl.keymkdir -p /usr/local/etc/apache22/ssl.crtchmod 0400 /usr/local/etc/apache22/ssl.keychmod 0400 /usr/local/etc/apache22/ssl.crtcp server.key /usr/local/etc/apache22/ssl.key/cp server.crt /usr/local/etc/apache22/ssl.crt/chmod 0400 /usr/local/etc/apache22/ssl.key/server.keychmod 0400 /usr/local/etc/apache22/ssl.crt/server.crt
Add / uncomment the following line in /usr/local/etc/apache22/httpd.conf:
Include etc/apache22/extra/httpd-ssl.conf
Add this to /usr/local/etc/apache22/httpd-vhosts.conf:
NameVirtualHost *:443
Edit httpd-ssl.conf and add your sites:
<VirtualHost *:443>Restart Apache
ServerAdmin webmaster@yoursystem.local
DocumentRoot "/usr/local/www/john"
ServerName john.yoursystem.local
ServerAlias john
ErrorLog "/var/log/john-error_log"
CustomLog "/var/log/john-access_log" common
SSLEngine on
SSLCertificateFile /usr/local/etc/apache22/server.crt
SSLCertificateKeyFile /usr/local/etc/apache22/server.key
<Directory "/usr/local/www/john">
Order Allow,Deny
Allow From All
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@yoursystem.local
DocumentRoot "/usr/local/www/jenn"
ServerName jenn.yoursystem.local
ServerAlias jenn
ErrorLog "/var/log/jenn-error_log"
CustomLog "/var/log/jenn-access_log" common
SSLEngine on
SSLCertificateFile /usr/local/etc/apache22/server.crt
SSLCertificateKeyFile /usr/local/etc/apache22/server.key
<Directory "/usr/local/www/jenn">
Order Allow,Deny
Allow From All
AllowOverride All
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>
Be aware of a few things:apachectl restart
1. Having multiple sites at one server with one certficate can pose a challenge, especially with name based vhosts read.
2. If you're running multiple sites with a common domain name, use a wildcard certificate.
3. Joomla itself has also SSL options (which you use for example at a webhosting site). It's on my to-do list for investigation.
I hope this was helpful. My next project is getting Wordpress running. Till next time !
No comments:
Post a Comment