| 66 |  | If you have purchased ssl certificate from a commercial CA substitute those with the self signed files. | 
          
            | 67 |  | If you wish to get '''letsencrypt''' certificates //Skip //to '''Step 10'''. | 
          
            | 68 |  |  | 
          
            | 69 |  | Create a Certificate and a Key self-signed for HTTPS: | 
          
            | 70 |  | * ```openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/ssl-sp.key -out /etc/ssl/certs/ssl-sp.crt -nodes -days 1095``` | 
          
            |  | 66 | If you have purchased ssl certificate from a commercial CA substitute those with the self signed files. If you wish to get '''letsencrypt''' certificates //Skip //to '''Step 10'''. | 
          
            |  | 67 |  | 
          
            |  | 68 | Create a Certificate and a Key self-signed for HTTPS: | 
          
            |  | 69 | * | 
          
            |  | 70 | {{{ | 
          
            |  | 71 | openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/ssl-sp.key -out /etc/ssl/certs ssl-sp.crt -nodes -days 1095 | 
          
            |  | 72 | }}} | 
        
        
          
            | 106 |  | ``` | 
          
            | 107 |  |  | 
          
            | 108 |  | 7. Enable **proxy_http**, **SSL** and **headers** Apache2 modules: | 
          
            | 109 |  | * ```a2enmod proxy_http ssl headers alias include negotiation``` | 
          
            | 110 |  | * ```a2ensite sp-ssl.conf``` | 
          
            | 111 |  | * ```systemctl restart apache2``` | 
          
            | 112 |  |  | 
          
            | 113 |  | 8. Configure Apache2 to open port **80** only for localhost: | 
          
            | 114 |  | * ```vim /etc/apache2/ports.conf``` | 
          
            | 115 |  |  | 
          
            | 116 |  | ```apache | 
          
            |  | 108 | }}} | 
          
            |  | 109 |  | 
          
            |  | 110 | 7. Enable '''proxy_http''', '''SSL''' and '''headers''' Apache2 modules: | 
          
            |  | 111 | * | 
          
            |  | 112 | {{{ | 
          
            |  | 113 | a2enmod proxy_http ssl headers alias include negotiation | 
          
            |  | 114 | }}} | 
          
            |  | 115 | * | 
          
            |  | 116 | {{{ | 
          
            |  | 117 | a2ensite sp-ssl.conf | 
          
            |  | 118 | }}} | 
          
            |  | 119 | * | 
          
            |  | 120 | {{{ | 
          
            |  | 121 | systemctl restart apache2 | 
          
            |  | 122 | }}} | 
          
            |  | 123 |  | 
          
            |  | 124 | 8. Configure Apache2 to open port '''80''' only for localhost: | 
          
            |  | 125 | * | 
          
            |  | 126 | {{{ | 
          
            |  | 127 | vim /etc/apache2/ports.conf | 
          
            |  | 128 | }}} | 
          
            |  | 129 | {{{ | 
        
        
          
            | 140 |  | ``` | 
          
            | 141 |  | 10. **Let'sencrypt** setup (*Skip this step if you already configured SSL with self signed or CA provided certificates*) | 
          
            | 142 |  |  | 
          
            | 143 |  | Disable the default configuration | 
          
            | 144 |  | * `cd /etc/apache2/sites-available/` | 
          
            | 145 |  | * `a2dissite 000-default.conf` | 
          
            | 146 |  | * `systemctl reload apache2` | 
          
            | 147 |  |  | 
          
            | 148 |  | Create a new conf file as `sp.conf` | 
          
            | 149 |  |  | 
          
            | 150 |  | * `cp 000-default.conf sp.conf` | 
          
            | 151 |  |  | 
          
            | 152 |  | Edit `sp.conf` with following | 
          
            | 153 |  |  | 
          
            | 154 |  | * `vim sp.conf` | 
          
            | 155 |  |  | 
          
            | 156 |  | ```apache | 
          
            |  | 155 | }}} | 
          
            |  | 156 | 10. '''Let'sencrypt''' setup (//Skip this step if you already configured SSL with self signed or CA provided certificates//) | 
          
            |  | 157 |  | 
          
            |  | 158 | Disable the default configuration | 
          
            |  | 159 | * | 
          
            |  | 160 | {{{ | 
          
            |  | 161 | cd /etc/apache2/sites-available/ | 
          
            |  | 162 | }}} | 
          
            |  | 163 | * | 
          
            |  | 164 | {{{ | 
          
            |  | 165 | a2dissite 000-default.conf | 
          
            |  | 166 | }}} | 
          
            |  | 167 | * | 
          
            |  | 168 | {{{ | 
          
            |  | 169 | systemctl reload apache2 | 
          
            |  | 170 | }}} | 
          
            |  | 171 | Create a new conf file as `sp.conf` | 
          
            |  | 172 | * | 
          
            |  | 173 | {{{ | 
          
            |  | 174 | cp 000-default.conf sp.conf | 
          
            |  | 175 | }}} | 
          
            |  | 176 | Edit `sp.conf` with following | 
          
            |  | 177 | * | 
          
            |  | 178 | {{{ | 
          
            |  | 179 | vim sp.conf | 
          
            |  | 180 | }}} | 
          
            |  | 181 | {{{ |