The Apache configuration files in Ubuntu are a little different from those in Solaris and FreeBSD, but they are essentially the same. Sometimes I wonder how many tricks this software can make on different platforms.
The basic situation of apache2 in Ubuntu is as follows:
The default site is at/var/www/
The configuration file is in/etc/apache2/
Log in/var/log/Apache/
The STARTUP script is/usr/SiN/apache2ctl or/etc/init. d/apache2.
Install apache2
# Apt-Get install apache2
Install the SSL module
# A2enmod SSL
Create a default SSL Certificate
# Apache2-ssl-certificate
Copy a site configuration as the prototype of SSL Configuration
# Cp/etc/apache2/sites-available/default/etc/apache2/sites-available/SSL
# Ln-S/etc/apache2/sites-available/SSL/etc/apache2/sites-enabled/SSL
Edit SSL configurations
# Vi/etc/apache2/sites-enabled/SSL
Change the port to 443
Add SSL authentication Configuration
Other custom configurations are the same as common configurations.
Namevirtualhost *:443
<Virtualhost *:443>
Serversignature on
Sslengine on
Sslcertificatefile/etc/apache2/SSL/Apache. pem
Serveradmin webmaster @ localhost
# [...]
Modify configurations of common HTTP methods
# Vi/etc/apache2/sites-enabled/Default
Change the port to 80
Namevirtualhost *:80
<Virtualhost *:80>
Serveradmin webmaster @ localhost
# [...]
Edit Apache port configuration and add port 443 (SSL)
# Vi/etc/apache2/ports. conf:
Listen 80
Listen 443.
Reload Apache configuration
#/Etc/init. d/apache2 force-Reload
The following is an example of an SSL configuration file:Namevirtualhost*: 443
<Virtualhost*: 443>
Serversignature on
Sslengine on
Sslcertificatefile/etc/apache2/SSL/Apache. pem
Serveradmin webmaster @ localhost
DocumentRoot/var/www/
< Directory />
Options followsymlinks
AllowOverride none
</ Directory >
< Directory /Var/WWW />
Options indexes followsymlinks Multiviews
AllowOverride none
Order allow, deny
Allow from all
# This directive allows us to have apache2's default start page
# In/apache2-default/, but still have/go to the right place
# Commented out for Ubuntu
# Redirectmatch ^/$/apache2-default/
</ Directory >
.