Skip to content

Commit

Permalink
home-manager/nginx: add default htmls, adminer
Browse files Browse the repository at this point in the history
adminer for administrating databases

can be accessed from localhost/adminer.php

Signed-off-by: John Titor <[email protected]>

fixup hm

Signed-off-by: John Titor <[email protected]>
  • Loading branch information
JohnRTitor committed Oct 2, 2024
1 parent 04349bb commit b99d8d2
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 0 deletions.
5 changes: 5 additions & 0 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

./services.nix # services
]
++ lib.optionals servicesSettings.nginx [
# Default Nginx server welcome testing page
# Nginx global config is located in ../dev-environment/nginx.nix
./web-server-html
]
++ lib.optionals osConfig.programs.thunar.enable [./thunar.nix]
++ lib.optionals servicesSettings.virtualisation [./virt-manager.nix];

Expand Down
16 changes: 16 additions & 0 deletions home-manager/web-server-html/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# this config file places relevant files in the home directory
# for the nginx localhost webserver
# THIS ONLY PLACES THE CONFIG FILES, DOES NOT INSTALL NGINX
# For that see ../../dev-environment/nginx.nix
# Import of thie module is controlled by bool: servicesSettings.nginx
{pkgs, ...}: {
home.file = {
"Website-Instances/index.php".source = ./index.php;
"Website-Instances/logos/nginx-logo.png".source = ./logos/nginx-logo.png;
"Website-Instances/logos/nixos-logo.png".source = ./logos/nixos-logo.png;

# To use adminer, just type localhost/adminer.php in your browser
# This configuration automatically places the php file in the correct location
"Website-Instances/adminer.php".source = "${pkgs.adminer}/adminer.php";
};
}
118 changes: 118 additions & 0 deletions home-manager/web-server-html/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test Page for the Nginx HTTP Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background-color: #fff;
color: #000;
font-size: 0.9em;
font-family: sans-serif,helvetica;
margin: 0;
padding: 0;
}
:link {
color: #c00;
}
:visited {
color: #c00;
}
a:hover {
color: #f50;
}
h1 {
text-align: center;
margin: 0;
padding: 0.6em 2em 0.4em;
background-color: #294172;
color: #fff;
font-weight: normal;
font-size: 1.75em;
border-bottom: 2px solid #000;
}
h1 strong {
font-weight: bold;
font-size: 1.5em;
}
h2 {
text-align: center;
background-color: #3C6EB4;
font-size: 1.1em;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0.5em;
border-bottom: 2px solid #294172;
}
hr {
display: none;
}
.content {
padding: 1em 5em;
}
.alert {
border: 2px solid #000;
}

img {
border: 2px solid #fff;
padding: 2px;
margin: 2px;
}
a:hover img {
border: 2px solid #294172;
}
.logos {
margin: 1em;
text-align: center;
}
/*]]>*/
</style>
</head>

<body>
<h1>Welcome to <strong>nginx</strong></h1>

<div class="content">
<p>This page is used to test the proper operation of the
<strong>nginx</strong> HTTP server after it has been
installed. If you can read this page, it means that the
web server installed at this site is working
properly.</p>

<div class="alert">
<h2>Website Administrator</h2>
<div class="content">
<p>This is the default <tt>index.php</tt> page that
is located in
<tt>/var/www/localhost-server/index.php</tt>.</p>


<?php
echo "If you see this text, PHP is also installed and working.<br/>";
echo 'Current PHP version: ' . phpversion();
?>

</div>
</div>

<div class="logos">
<a href="http://nginx.net/"><img
src="./logos/nginx-logo.png"
alt="[ Powered by nginx ]"
width="121" height="32" /></a>

<a href="https://nixos.org/"><img
src="./logos/nixos-logo.png"
alt="[ Powered by NixOS ]"
width="110" height="32" /></a>
</div>
</div>
</body>
</html>



Binary file added home-manager/web-server-html/logos/nginx-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b99d8d2

Please sign in to comment.