SimpleHTTP
Aller à la navigation
Aller à la recherche
| Fiche express | |
|---|---|
| Rôle | Serveur HTTP minimal fourni par Python |
| Python 2 | python -m SimpleHTTPServer
|
| Python 3 | python3 -m http.server
|
| Voir aussi | Reseau::py · Python |
Python embarque un serveur HTTP minimal pratique pour partager rapidement le contenu d'un répertoire. Il sert le dossier courant sur le port 8000 par défaut.
Démarrer un serveur
Python 2 :
yum install python
python -m SimpleHTTPServer
Puis accéder à http://127.0.0.1:8000
Python 3 (équivalent moderne) :
python3 -m http.server
Exposition en TLS via ncat
On peut placer le serveur derrière un relais TLS avec ncat :
python -m SimpleHTTPServer & ncat --ssl -l 8443 --sh-exec "ncat 127.0.0.1 8000" --keep-open
Voir aussi
- Reseau::py — programmation par sockets
- Python — sommaire du langage