From Fedora Project Wiki

No edit summary
No edit summary
Line 12: Line 12:


=== Create self signed certificate ===
=== Create self signed certificate ===
Install crypto-utils
<pre>$ yum install crypto-utils</pre>
Use genkey to create a certificate for a new hostname
<pre>$ genkey hostname</pre>
If your server already has a valid certificate and you want to replace use this to set a different serial number so that clients notice the change in certificate and update to the new one without failing
<pre>$ openssl req -x509 -new -set_serial number -key hostname.key -out hostname.crt</pre>


=== Install a certificate ===
=== Install a certificate ===
If your certificate was generated in another computer move the certificate and the key file to the correct folder
<pre>$ mv key_file.key /etc/pki/tls/private/hostname.key
$ mv certificate.crt /etc/pki/tls/certs/hostname.crt</pre>
If you want to install the certificate as default open /etc/httpd/conf.d/ssl.conf and edit this lines
<pre>SSLCertificateFile /etc/pki/tls/certs/hostname.crt
SSLCertificateKeyFile /etc/pki/tls/private/hostname.key</pre>
If you want to install the certificate only for a specific host open that host configuration file and paste this lines
<pre>SSLCertificateFile /etc/pki/tls/certs/hostname.crt
SSLCertificateKeyFile /etc/pki/tls/private/hostname.key</pre>


== Configuration ==
== Configuration ==
Line 28: Line 49:


However this exposes your computer to the Internet and potentially to attackers. Secure your installation properly before exposing your server to the Internet.
However this exposes your computer to the Internet and potentially to attackers. Secure your installation properly before exposing your server to the Internet.
== Links ==
* [https://docs.fedoraproject.org/en-US/Fedora/14/html/Deployment_Guide/s1-apache-mod_ssl.html Fedora Documentation, Setting Up an SSL Server]

Revision as of 20:32, 1 May 2014

The Apache HTTP Server is the main web server worldwide

Installation

$ su root
$ yum install httpd

If you want SSL support install also openssl and mod_ssl

$ yum install openssl mod_ssl

Enable start on boot

$ systemctl enable httpd

Create self signed certificate

Install crypto-utils

$ yum install crypto-utils

Use genkey to create a certificate for a new hostname

$ genkey hostname

If your server already has a valid certificate and you want to replace use this to set a different serial number so that clients notice the change in certificate and update to the new one without failing

$ openssl req -x509 -new -set_serial number -key hostname.key -out hostname.crt

Install a certificate

If your certificate was generated in another computer move the certificate and the key file to the correct folder

$ mv key_file.key /etc/pki/tls/private/hostname.key
$ mv certificate.crt /etc/pki/tls/certs/hostname.crt

If you want to install the certificate as default open /etc/httpd/conf.d/ssl.conf and edit this lines

SSLCertificateFile /etc/pki/tls/certs/hostname.crt
SSLCertificateKeyFile /etc/pki/tls/private/hostname.key

If you want to install the certificate only for a specific host open that host configuration file and paste this lines

SSLCertificateFile /etc/pki/tls/certs/hostname.crt
SSLCertificateKeyFile /etc/pki/tls/private/hostname.key

Configuration

Configuration files are stored under /etc/httpd/conf.d/ and /etc/httpd/conf/httpd.conf is the main configuration file

Apache uses port 80 for plain http connections and port 443 for SSL connections by default. To make this service available from other computers or the Internet your have to allow Apache through the firewall like this

For plain http connections

$ firewall-cmd --permanent --add-service=http

For SSL connections

$ firewall-cmd --permanent --add-service=https

However this exposes your computer to the Internet and potentially to attackers. Secure your installation properly before exposing your server to the Internet.

Links