You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aney.co.uk/guides/adminer-setup.html

89 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content="Blog, articles, guide, mysql, mariadb, database">
<meta name="author" content="Nathan (Aney) Steel">
<meta name="theme-color" content="white">
<meta name="theme-color" content="black">
<link rel="stylesheet" type="text/css" href="/main.css">
<link rel="icon" type="image/png" href="/images/favicon.svg">
<title>Adminer Setup</title>
</head>
<body>
<header>
<a href="#main" class="vh">Jump directly to main content</a>
<h1>Adminer Setup</h1>
<input id="burger-toggle" type="checkbox"/>
<label class="burger-container" for="burger-toggle"><div class="burger"></div><span class="sr">Burger menu</span></label>
<hr/>
<nav>
<a href="/">home</a>
<a href="/about.html">about</a>
<a href="/projects.html">projects</a>
<a href="/blog/">blog</a>
<a href="/sitemap.html">misc</a>
<a href="/support.html">support</a>
</nav>
<hr/>
</header>
<main id="main">
<section>
<p>Adminer is a simple front-end for your database server that can be access through the browser</p>
<h2>Pre-Requirements</h2>
<p>To run adminer, you'll need a webserver with php set up. Thankfully I'm a great guy, and have written about these topics before.</p>
<ul>
<li><a href="/guides/nginx-install.html">Nginx Webserver Setup</a></li>
<li><a href="/guides/add-php-to-nginx.html">PHP setup for NGINX</a></li>
</ul>
<h2>Download the latest release</h2>
<p>This will download the latest release to your default web directory, this can be changed, by altering the path following <strong>-O</strong>.</p>
<pre><code>wget "http://www.adminer.org/latest.php" -O /var/www/html/adminer.php</code></pre>
<h2>Set permissions for your web server</h2>
<pre><code>chown -R www-data:www-data /var/www/html/adminer.php
chmod 755 /var/www/html/adminer.php</code></pre>
<h2>Access it</h2>
<p>Head to your <strong>&lt;WEBSITE/IP&gt;/adminer.php</strong>, and you should load into the adminer login. Using your mysql/mariaDB credentials, you can then login, and use the GUI to manage your database(s)</p>
<h2>Make it a directory, not a file</h2>
<p>Instead of accessing <strong>/adminer.php?&lt;ARGUMENTS&gt;</strong>, we can make it look like <strong>/adminer/&lt;ARGUMENTS&gt;</strong></p>
<pre><code>location /adminer/ {
root /var/www/html ;
try_files $uri $uri/ /adminer/index.php/$is_args$args ;
}</code></pre>
<h2>Password Protect</h2>
<p>An additional level of security, just in case. Using Htaccess, any file, or directory can be password protected</p>
<pre><code>sudo apt install apache2-utils
htpasswd -c /home/&lt;USER&gt;/.htpasswd admin</code></pre>
<h3>Add to location</h3>
<p>Add the location of the auth file to the adminer location block</p>
<pre><code>auth_basic "Adminer" ;
auth_basic_user_file /home/&lt;USER/&gt;.htpasswd ;</code></pre>
<p>They block should look like below</p>
<pre><code>location /adminer/ {
auth_basic "Adminer" ;
auth_basic_user_file /home/&lt;USER&gt;/.htpasswd ;
root /var/www/html ;
try_files $uri $uri/ /adminer/index.php/$is_args$args ;
}</code></pre>
</section>
</main>
<footer>
<hr/>
<p>Written by <a href="https://aney.co.uk" target="_blank" rel="noopener">@aney</a> with <a href="https://danluu.com/web-bloat/" target="_blank" rel="noopener">web bloat</a> in mind | <a href="https://github.com/Aney/website" target="_blank" rel="noopener">Source Code</a></p>
</footer>
</body>
</html>