1 line
1.4 KiB
JSON
1 line
1.4 KiB
JSON
{"uuid":"d146010e-a83b-44bb-885b-72845ae54e0c","slug":"fournir-un-service-http","title":"Fournir un service http en Python","author":"cedric@abonnel.fr","published":true,"published_at":"2020-04-17 18:05:23","created_at":"2020-04-17 18:05:23","updated_at":"2020-04-17 18:05:23","revisions":[],"cover":"","files_meta":[],"external_links":[],"seo_title":"","seo_description":"","og_image":"","category":"Informatique","content":"# Fournir un service http en Python\n\n\nLe bout de code suivant permet d’exécuter temporairement un service http (80/tcp) en **Python**.\n\nLe 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`.\n\nSi 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.\n\n```python\nmkdir -p /tmp/certbot/public_html/.well-known/acme-challenge\n\ncd /tmp/certbot/public_html\n\nprintf \"%s\" asFY_-_9W8N-Z4zPKwXvu5_pBv1kMAC4j3ag7VWFAko.Rj9bJx4j8slMw-Pxkq47MKU3TybtCD4ohJxc6kafaX0 > .well-known/acme-challenge/asFY_-_9W8N-Z4zPKwXvu5_pBv1kMAC4j3ag7VWFAko\n\nsudo $(command -v python2 || command -v python2.7 || command -v python2.6) -c \"import BaseHTTPServer, SimpleHTTPServer; \\\ns = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \\\ns.serve_forever()\"\n```","featured":false,"tags":[]} |