I’ve been spoiled by CentOS/Fedora’s yum and Ubuntu’s apt for along time, so when I need to install a new Apache, I have to learn again. The machine is Fedora Core 6. Yes, it’s an old version.
After unpack it, this is my configure options:
./configure --prefix=/opt/apache2215 --enable-mods-shared=most \ --enable-so --enable-ssl --enable-deflate
and then, as usual, make and make install command. In /opt/apache2215/conf/httpd.conf, change the lines:
DocumentRoot "/var/www/htdocs" <Directory "/var/www/htdocs"> ... </Directory>
You may wish to change /var/www/htdocs.
I’m using /etc/init.d/httpd from Fedora, and just change:
# Path to the apachectl script, server binary, and short-form for messages. apachectl=/opt/apache2215/bin/apachectl httpd=${HTTPD-/opt/apache2215/bin/httpd}
Everything else are the same.
I’m editing /etc/sysconfig/httpd too and add these lines:
OPTIONS='-d /opt/apache2215' PIDFILE=/var/run/httpd.pid LOCKFILE=/var/lock/subsys/httpd CONFFILE=/opt/apache2215/conf/httpd.conf
To prevent ever growing log files, I add these lines in /etc/logrotate.d/httpd (if you install logrotate):
/opt/apache2215/logs/*log { missingok nocompress daily rotate 14 notifempty sharedscripts postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript }
Try to start/stop/restart to test it. If succeed, the next step is activate mod_ssl. Execute these lines below:
# Generate private key openssl genrsa -out ca.key 1024 # Generate CSR openssl req -new -key ca.key -out ca.csr # Generate Self Signed Key openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt # Move the files to the correct locations mv ca.crt /etc/pki/tls/certs mv ca.key /etc/pki/tls/private/ca.key mv ca.csr /etc/pki/tls/private/ca.csr
Those command will generate self-signed certificate key for aour server. In /opt/apache2215/conf/httpd.conf, add the modules and make sure that the line contain Include conf/extra/httpd-ssl.conf not commented:
LoadModule ssl_module modules/mod_ssl.so # Secure (SSL/TLS) connections Include conf/extra/httpd-ssl.conf
In /opt/apache2215/conf/extra/httpd-ssl.conf, edit these lines:
<VirtualHost _default_:443> ... ErrorLog "/opt/apache2215/logs/error_log" TransferLog "/opt/apache2215/logs/access_log" SSLCertificateFile "/etc/pki/tls/certs/ca.crt" SSLCertificateKeyFile "/etc/pki/tls/private/ca.key" </VirtualHost>
Try to restart and access https://yourhost to test it.