Javiertury (talk | contribs) |
Javiertury (talk | contribs) |
||
Line 39: | Line 39: | ||
Configuration files are stored under <code>/etc/httpd/conf.d/</code> and <code>/etc/httpd/conf/httpd.conf</code> is the main configuration file | Configuration files are stored under <code>/etc/httpd/conf.d/</code> and <code>/etc/httpd/conf/httpd.conf</code> is the main configuration file | ||
=== Opening ports === | |||
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 | 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 | ||
Line 49: | Line 51: | ||
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. | ||
=== Disable test page === | |||
To disable the test page comment out all the lines in this file <code>/etc/httpd/conf.d/welcome.conf</code> | |||
== Links == | == Links == | ||
* [https://docs.fedoraproject.org/en-US/Fedora/14/html/Deployment_Guide/s1-apache-mod_ssl.html Fedora Documentation, Setting Up an SSL Server] | * [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:55, 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, usually /etc/httpd/conf.d/hostname.conf
, and paste this lines between <VirtualHost hostname:port> and </VirtualHost>
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
Opening ports
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.
Disable test page
To disable the test page comment out all the lines in this file /etc/httpd/conf.d/welcome.conf