servnest/ht/le.php

35 lines
1.0 KiB
PHP
Raw Normal View History

2021-01-22 21:58:46 +01:00
<?php require "../top.inc.php"; ?>
<p>
Installer un certificat Let's Encrypt
</p>
2021-01-23 17:26:46 +01:00
<form method="post">
<label for="domain">Domaine sur lequel installer le certificat</label><br>
<input required="" placeholder="site.atope.art" id="domain" name="domain" type="text"><br>
2021-01-22 21:58:46 +01:00
<input value="Valider" type="submit">
2021-01-22 21:58:46 +01:00
</form>
<?php
if (isset($_POST['domain'])) {
exec("sudo /root/maniver/target/debug/maniver le-install " . $_POST['domain'], $output);
echo "<pre>";
print_r($output);
echo "</pre>";
$conf = file_get_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf");
$conf = preg_replace("#host\.atope\.art#", $_POST['domain'], $conf);
file_put_contents("/etc/nginx/hyper.d/" . $_POST['domain'] . ".conf", $conf);
exec("sudo /root/maniver/target/debug/maniver reload-nginx");
echo "Formulaire traité !!";
} else {
echo "Rien n'a été reçu lors du dernier chargement";
}
?>
<?php require "../bottom.inc.php"; ?>