18 lines
937 B
Markdown
18 lines
937 B
Markdown

|
||
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.
|
||
|
||
```python
|
||
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()"
|
||
``` |