Install Ubuntu Server 11.04 Apache + SSL
I use following steps.
1) Installation of Apache HTTP Server
2) Enable SSL
3) additional Information
1) Installation of Apache HTTP Server
2) Enable SSL
3) additional Information
1) Installation of Apache HTTP Server
Install Apache using tasksel
(GUI Version)
$ sudo tasksel
Select LAMP server and press OK
(Command Line Version)
$ sudo tasksel install lamp-server
Install Apache using aptitude
Check the apache installed or not
$ dpkg -L apache #?####
$ dpkg -l | grep apache
Install command
$ sudo aptitude -y install apache2
Apche2 information
All configuration file saved here : /etc/apache2/
Document Root : /var/www/
Restart apache2
$ sudo /etc/init.d/apache2 restart
2) Enable SSL
$ sudo a2enmod ssl
Publish private key and SSL certificate
Make directory for cert.
$ sudo mkdir /etc/apache2/ssl/
$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
Enter hostname or IP address for confirmation screen.
192.168.0.60
"make-ssl-cert" command is the shell script.
/usr/sbin/make-ssl-cert
Defaultly certificate is enable for 10 year or 3650 days.
Sample: if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes -out $output -keyout $output > $TMPOUT 2>&1
Copy the configuration
$ sudo cp -p /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz /etc/apache2/sites-available/
$ sudo gunzip /etc/apache2/sites-available/httpd-ssl.conf.gz
Edit configuration file
$ sudo vi /etc/apache2/sites-available/httpd-ssl.conf
Edit as below
#Listen 443 <= Comment out
<VirtualHost _default_:443>
DocumentRoow "/var/www"
ServerName 192.168.0.100:443
ServerAdmin (Server admin mail address)
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.pem
Disable default "default-ssl"
$ sudo a2dissite default-ssl
Register siet
$ sudo a2ensite httpd-ssl.conf
HTTP service restart
$ sudo /etc/init.d/apache2 restart
3)Additional Information
Uninstall with command below then /etc/apache2/
$ sudo aptitude -y remove apache2
Same with purge too.
$ sudo aptitude -y purge apache2
After deleted file below
$ sudo rm -rf /etc/apache2/
$ sudo rm -rf /var/www/
And install again got error below
$ sudo aptitude -y install apache2
$ sudo /etc/init.d/apache2 restart
Can't open /etc/apache2/envvars
Looks like service file wasn't created.
Then I use following step
Check installed package
$ dpkg --get-selections | grep apache
apache2.2-common deinstall
Remove one by one listed package.
$ sudo dpkg --purge apache2.2-common
After installed restart service.
$ sudo aptitude -y install apache2
$ sudo /etc/init.d/apache2 restart
Install Apache using tasksel
(GUI Version)
$ sudo tasksel
Select LAMP server and press OK
(Command Line Version)
$ sudo tasksel install lamp-server
Install Apache using aptitude
Check the apache installed or not
$ dpkg -L apache #?####
$ dpkg -l | grep apache
Install command
$ sudo aptitude -y install apache2
Apche2 information
All configuration file saved here : /etc/apache2/
Document Root : /var/www/
Restart apache2
$ sudo /etc/init.d/apache2 restart
2) Enable SSL
$ sudo a2enmod ssl
Publish private key and SSL certificate
Make directory for cert.
$ sudo mkdir /etc/apache2/ssl/
$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
Enter hostname or IP address for confirmation screen.
192.168.0.60
"make-ssl-cert" command is the shell script.
/usr/sbin/make-ssl-cert
Defaultly certificate is enable for 10 year or 3650 days.
Sample: if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes -out $output -keyout $output > $TMPOUT 2>&1
Copy the configuration
$ sudo cp -p /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz /etc/apache2/sites-available/
$ sudo gunzip /etc/apache2/sites-available/httpd-ssl.conf.gz
Edit configuration file
$ sudo vi /etc/apache2/sites-available/httpd-ssl.conf
Edit as below
#Listen 443 <= Comment out
<VirtualHost _default_:443>
DocumentRoow "/var/www"
ServerName 192.168.0.100:443
ServerAdmin (Server admin mail address)
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.pem
Disable default "default-ssl"
$ sudo a2dissite default-ssl
Register siet
$ sudo a2ensite httpd-ssl.conf
HTTP service restart
$ sudo /etc/init.d/apache2 restart
3)Additional Information
Uninstall with command below then /etc/apache2/
$ sudo aptitude -y remove apache2
Same with purge too.
$ sudo aptitude -y purge apache2
After deleted file below
$ sudo rm -rf /etc/apache2/
$ sudo rm -rf /var/www/
And install again got error below
$ sudo aptitude -y install apache2
$ sudo /etc/init.d/apache2 restart
Can't open /etc/apache2/envvars
Looks like service file wasn't created.
Then I use following step
Check installed package
$ dpkg --get-selections | grep apache
apache2.2-common deinstall
Remove one by one listed package.
$ sudo dpkg --purge apache2.2-common
After installed restart service.
$ sudo aptitude -y install apache2
$ sudo /etc/init.d/apache2 restart
No comments:
Post a Comment