Apache []

Outils pour utilisateurs

Outils du site


Apache

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
documentation:informatique:linux:apache:index [2019/01/22 14:09] – [Redirection http ➡ https] f1slsdocumentation:informatique:linux:apache:index [2019/05/05 16:22] (Version actuelle) f1sls
Ligne 1: Ligne 1:
 ====== Apache ====== ====== Apache ======
 +
 +===== Sécurité =====
 +  * https://bobcares.com/blog/apache-prevent-ddos/
  
 ===== SSL / https ===== ===== SSL / https =====
Ligne 137: Ligne 140:
  
 ===== Redirection http ➡ https ===== ===== Redirection http ➡ https =====
 +[[https://www.tecmint.com/redirect-http-to-https-on-apache/|Source]]
 ==== Redirect HTTP to HTTPS on Apache Using .htaccess File ==== ==== Redirect HTTP to HTTPS on Apache Using .htaccess File ====
  
Ligne 157: Ligne 161:
  
 Now, when a visitor types http://www.yourdomain.com the server will automatically redirect HTTP to HTTPS  https://www.yourdomain.com. Now, when a visitor types http://www.yourdomain.com the server will automatically redirect HTTP to HTTPS  https://www.yourdomain.com.
 +
 +
 +==== Redirect HTTP to HTTPS on Apache Virtual Host ====
 +Additionally, to force all web traffic to use HTTPS, you can also configure your virtual host file. Normally, there are two important sections of a virtual host configurations if an SSL certificate is enabled; the first contains configurations for the non-secure port 80.
 +
 +The second is for the secure port 443. To redirect HTTP to HTTPS for all the pages of your website, first open the appropriate virtual host file. Then modify it by adding the configuration below.
 +
 +<code>
 +NameVirtualHost *:80
 +<VirtualHost *:80>
 +   ServerName www.yourdomain.com
 +   Redirect / https://www.yourdomain.com
 +</VirtualHost>
 +</code>
 +
 +<code>
 +<VirtualHost _default_:443>
 +   ServerName www.yourdomain.com
 +   DocumentRoot /usr/local/apache2/htdocs
 +   SSLEngine On
 +# etc...
 +</VirtualHost>
 +</code>
 +
 +Save and close the file, then restart the HTTP sever like this.
 +
 +<code lang="bash">
 +$ sudo systemctl restart apache2     [Ubuntu/Debian]
 +$ sudo systemctl restart httpd      [RHEL/CentOS]
 +</code>
 +
 +While the ''<VirtualHost>'' is the most recommended solution because it is simpler and safer.
documentation/informatique/linux/apache/index.1548162597.txt.gz · Dernière modification : de f1sls