servnest/ht/le.php

34 lines
1 KiB
PHP

<?php require "../top.inc.php"; ?>
<p>
Installer un certificat Let's Encrypt
</p>
<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>
<input value="Valider" type="submit">
</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"; ?>