Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tp-www-ssl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vincent MAZENOD
tp-www-ssl
Commits
85623278
Commit
85623278
authored
8 years ago
by
Pascal Lafourcade
Browse files
Options
Downloads
Patches
Plain Diff
q
parent
f6406a59
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TP-https.md
+46
-7
46 additions, 7 deletions
TP-https.md
provision1.sh
+12
-0
12 additions, 0 deletions
provision1.sh
with
58 additions
and
7 deletions
TP-https.md
+
46
−
7
View file @
85623278
...
...
@@ -149,23 +149,62 @@ Question 5 : Regarder le contenu du fichier
# Configuration d'Apache2
La commande suivant active le module ssl d'Apache2
Pour les fichiers de configuration d'Apache2 lisez les fichiers suivants :
`/etc/apache2/ports.conf`
port 443 `/etc/apache2/sites-available/default-ssl.conf`
port 80 ``/etc/apache2/sites-available/000-default.conf`
La commande suivant active le module ssl d'Apache2 (a2 = apache2, en = enable, mod = module)
```
bash
sudo a2enmod ssl
```
Ce qui est équivalent à la commande suivante `ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf`
La commande suivante active active le virtual host
```
bash
sudo a2ensite default-ssl
```
Elle est équivalente aux deux commandes suivantes:
`ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/ssl.conf`
`ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ssl.load`
La commande suivante relance le serveur Apache2
```
bash
sudo systemctl reload apache2.service
```
Qu'observez-vous sur le site `http://0.0.0.0:8443/`
Question 7 : Qu'observez-vous sur le site `http://0.0.0.0:8443/`? Est-ce normal ?
Question 8 : Observer ce site en https?
Question 9 : Vérifier les détails des certificats avant d'accepter.
# Ne plus utiliser que https
Bad Request
```
bash
sudo a2enmod rewrite
```
# add 3 lines
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L]
# to /etc/apache2/sites-enabled/000-default.conf
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Apache/2.4.10 (Debian) Server at 127.0.1.1 Port 443
sudo sed -i 's/<\/VirtualHost>/ RewriteEngine On\n<\/VirtualHost>/' /etc/apache2/sites-enabled/000-default.conf
sudo sed -i 's/<\/VirtualHost>/ RewriteCond %{HTTPS} off\n<\/VirtualHost>/' /etc/apache2/sites-enabled/000-default.conf
sudo sed -i 's/<\/VirtualHost>/ RewriteRule (.*) https:\/\/%{SERVER_NAME}:8443$1 [R,L]\n<\/VirtualHost>/' /etc/apache2/sites-enabled/000-default.conf
```
bash
sudo systemctl reload apache2.service
```
This diff is collapsed.
Click to expand it.
provision1.sh
+
12
−
0
View file @
85623278
...
...
@@ -12,3 +12,15 @@ sudo a2enmod ssl
sudo
a2ensite default-ssl
sudo
systemctl reload apache2.service
# STEP 5 - make host accessible with https only - 80 closed or forwarded
sudo
a2enmod rewrite
# add 3 lines
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L]
# to /etc/apache2/sites-enabled/000-default.conf
sudo sed
-i
's/<\/VirtualHost>/ RewriteEngine On\n<\/VirtualHost>/'
/etc/apache2/sites-enabled/000-default.conf
sudo sed
-i
's/<\/VirtualHost>/ RewriteCond %{HTTPS} off\n<\/VirtualHost>/'
/etc/apache2/sites-enabled/000-default.conf
sudo sed
-i
's/<\/VirtualHost>/ RewriteRule (.*) https:\/\/%{SERVER_NAME}:8443$1 [R,L]\n<\/VirtualHost>/'
/etc/apache2/sites-enabled/000-default.conf
sudo
systemctl reload apache2.service
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment