Archive for the ‘Apache’ Category

Apache: Install SSL on Virtual Host

Sunday, September 27th, 2009

Here is the minimum configuration to enable SSL

Load the module and configure the certificate

LoadModule ssl_module modules/mod_ssl.so
Listen 443
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /path/to/domain-certificate.crt
SSLCertificateKeyFile /path/to/domain-key.key
SSLCertificateChainFile /path/to/bundle-certificate.crt
SSLCACertificateFile /path/to/bundle-certificate.crt

….

NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot /path/to/html/
ServerName www.mysecuredomain.com
SSLEngine on
</VirtualHost>

Pre-requisites:

  1. Disable your /etc/httpd/conf.d/ssl.conf by renaming it to ssl.conf.disabled (otherwise, Apache will take the properties from this file, and it can get quite confusing).
  2. Open your firewall for https protocol
  3. Get a certificate (Godaddy have the cheapest one, especially for wildcard ones)

Related links

Apache: SSL Certificate generate CSR

Friday, August 7th, 2009

CSR-Generation Instructions

To generate a triple-DES encrypted key pair and a Certificate Signing Request (CSR):

Enter the following commands:

  1. cd /usr/bin/ (/your path to openssl/)
    Enter a passphrase when prompted to.
  2. openssl genrsa -des3 -out <name of your certificate>.key 1024
  3. openssl req -new -key <name of your certificate>.key -out <name of your certificate>.csr

If you are requesting a Wildcard certificate, please add an asterisk (*) on the left side of the Common Name (e.g., “*.domainnamegoes.com” or “www*.domainnamegoeshere.com”). This will secure all subdomains of the Common Name.

(source: Godaddy’s help)

BTW, Godaddy has the cheapest certificates you can find (with great support).

Apache: Applying license to code

Friday, July 31st, 2009
Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

See Apache V2 licensing

Apache: htpasswd Create User for Apache Auth File

Sunday, February 8th, 2009

First user creation (create file and first user):

htpasswd -cm /path/to/auth-conf yourusername

Subsequent user creation

htpasswd -m /path/to/auth-conf yourusername

Apache: Permanent Redirect Directive in Apache httpd conf

Thursday, December 4th, 2008

Redirecting from the http.conf

<VirtualHost *:80>
  ServerName mydomainname.com
  Redirect permanent / http://www.otherdomainname.com/
</VirtualHost>