mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-12-18 06:37:06 +00:00
90 lines
3.9 KiB
HTML
90 lines
3.9 KiB
HTML
<style>
|
|
</style>
|
|
|
|
<h2>Static Web Hosting</h2>
|
|
|
|
<p>This machine is serving a simple, static website at <a href="https://{{hostname}}">https://{{hostname}}</a> and at all domain names that you set up an email user or alias for.</p>
|
|
|
|
<h3>Uploading web files</h3>
|
|
|
|
<p>You can replace the default website with your own HTML pages and other static files. This control panel won’t help you design a website, but once you have <tt>.html</tt> files you can upload them following these instructions:</p>
|
|
|
|
<ol>
|
|
<li>Ensure that any domains you are publishing a website for have no problems on the <a href="#system_status" onclick="return show_panel(this);">Status Checks</a> page.</li>
|
|
|
|
<li>On your personal computer, install an SSH file transfer program such as <a href="https://filezilla-project.org/">FileZilla</a> or <a href="http://linuxcommand.org/man_pages/scp1.html">scp</a>.</li>
|
|
|
|
<li>Log in to this machine with the file transfer program. The server is <strong>{{hostname}}</strong>, the protocol is SSH or SFTP, and use the <strong>SSH login credentials</strong> that you used when you originally created this machine at your cloud host provider. This is <strong>not</strong> what you use to log in either for email or this control panel. Your SSH credentials probably involves a private key file.</li>
|
|
|
|
<li>Upload your <tt>.html</tt> or other files to the directory <tt>{{storage_root}}/www/default</tt> on this machine. They will appear directly and immediately on the web.</li>
|
|
|
|
<li>The websites set up on this machine are listed in the table below with where to put the files for each website.</li>
|
|
|
|
<table id="web_domains_existing" class="table" style="margin-bottom: 1em; width: auto;">
|
|
<thead>
|
|
<tr>
|
|
<th>Site</th>
|
|
<th>Directory for Files</th>
|
|
<th/>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
|
|
<p>To add a domain to this table, create a dummy <a href="#users" onclick="return show_panel(this);">mail user</a> or <a href="#aliases" onclick="return show_panel(this);">alias</a> on the domain first and see the <a href="https://mailinabox.email/guide.html#domain-name-configuration">setup guide</a> for adding nameserver records to the new domain at your registrar (but <i>not</i> glue records).</p>
|
|
|
|
</ol>
|
|
|
|
<script>
|
|
function show_web() {
|
|
api(
|
|
"/web/domains",
|
|
"GET",
|
|
{
|
|
},
|
|
function(domains) {
|
|
var tb = $('#web_domains_existing tbody');
|
|
tb.text('');
|
|
for (var i = 0; i < domains.length; i++) {
|
|
if (!domains[i].static_enabled) continue;
|
|
var row = $("<tr><th class='domain'><a href=''></a></th><td class='directory'><tt/></td> <td class='change-root hidden'><button class='btn btn-default btn-xs' onclick='show_change_web_root(this)'>Change</button></td></tr>");
|
|
tb.append(row);
|
|
row.attr('data-domain', domains[i].domain);
|
|
row.attr('data-custom-web-root', domains[i].custom_root);
|
|
row.find('.domain a').text('https://' + domains[i].domain);
|
|
row.find('.domain a').attr('href', 'https://' + domains[i].domain);
|
|
row.find('.directory tt').text(domains[i].root);
|
|
if (domains[i].root != domains[i].custom_root)
|
|
row.find('.change-root').removeClass('hidden');
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function do_web_update() {
|
|
api(
|
|
"/web/update",
|
|
"POST",
|
|
{
|
|
},
|
|
function(data) {
|
|
if (data == "")
|
|
data = "Nothing changed.";
|
|
else
|
|
data = $("<pre/>").text(data);
|
|
show_modal_error("Web Update", data, function() { show_web() });
|
|
});
|
|
}
|
|
|
|
function show_change_web_root(elem) {
|
|
var domain = $(elem).parents('tr').attr('data-domain');
|
|
var root = $(elem).parents('tr').attr('data-custom-web-root');
|
|
show_modal_confirm(
|
|
'Change Root Directory for ' + domain,
|
|
'<p>You can change the static directory for <tt>' + domain + '</tt> to:</p> <p><tt>' + root + '</tt></p> <p>First create this directory on the server. Then click Update to scan for the directory and update web settings.',
|
|
'Update',
|
|
function() { do_web_update(); });
|
|
}
|
|
</script>
|