informatique:langage:python:fournir_un_service_http

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édentes Révision précédente
loisirs:podcasts:informatique:langage:python:fournir_un_service_http [2020/04/17 20:01] – ↷ Page déplacée de informatique:langage:python:fournir_un_service_http à loisirs:podcasts:informatique:langage:python:fournir_un_service_http jsideinformatique:langage:python:fournir_un_service_http [2020/04/17 20:05] (Version actuelle) – ↷ Page déplacée de loisirs:podcasts:informatique:langage:python:fournir_un_service_http à informatique:langage:python:fournir_un_service_http jside
Ligne 1: Ligne 1:
 +====== Fournir un service http en Python ======
 +
 +{{ informatique:langage:python:do_web_python.png?500|}}
 +Le bout de code suivant permet d’exécuter temporairement un service http (80/tcp) en **Python**.
 +
 +Le dossier où vous vous trouvez devient le "BaseHTTP", c'est-à-dire la racine du site accessible en http. Dans l'exemple, il s'agit du dossier ''/tmp/certbot/public_html''.
 +
 +Si vous avez déjà un service httpd comme Apache qui fonctionne et occupe déjà le port 80, il faudra veiller à l'arrêter avant.
 +
 +<WRAP clear/>
 +
 +
 +<code python [enable_line_numbers="true"]>
 +mkdir -p /tmp/certbot/public_html/.well-known/acme-challenge
 +
 +cd /tmp/certbot/public_html
 +
 +printf "%s" asFY_-_9W8N-Z4zPKwXvu5_pBv1kMAC4j3ag7VWFAko.Rj9bJx4j8slMw-Pxkq47MKU3TybtCD4ohJxc6kafaX0 > .well-known/acme-challenge/asFY_-_9W8N-Z4zPKwXvu5_pBv1kMAC4j3ag7VWFAko
 +
 +sudo $(command -v python2 || command -v python2.7 || command -v python2.6) -c "import BaseHTTPServer, SimpleHTTPServer; \
 +s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
 +s.serve_forever()"
 +</code>
 +
  
  • informatique/langage/python/fournir_un_service_http.txt
  • Dernière modification : 2020/04/17 20:05
  • de jside