add new
This commit is contained in:
16
apache2-minimal/CHANGELOG.md
Normal file
16
apache2-minimal/CHANGELOG.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## 2.1.1
|
||||
- bump hassio-addon-base to V10.0.1
|
||||
|
||||
## 2.1.0
|
||||
- bump hassio-addon-base to V10.0.0
|
||||
|
||||
## 2.0.3
|
||||
- Enable Apache Foreground Logging
|
||||
|
||||
## 2.0.2
|
||||
- ability to set a username and password to access the webfiles
|
||||
|
||||
## 2.0.0
|
||||
- Initial release of the minimal Version
|
||||
20
apache2-minimal/Dockerfile
Normal file
20
apache2-minimal/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.1
|
||||
# hadolint ignore=DL3006
|
||||
FROM ${BUILD_FROM}
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Create directory for apache2 to store PID file
|
||||
RUN mkdir /run/apache2
|
||||
|
||||
RUN apk --no-cache add apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
|
||||
|
||||
#Configure Logging
|
||||
RUN sed -i -r 's@Errorlog .*@Errorlog /dev/stderr@i' /etc/apache2/httpd.conf
|
||||
RUN echo "Transferlog /dev/stdout" >> /etc/apache2/httpd.conf
|
||||
|
||||
# Copy data for add-on
|
||||
COPY run.sh /
|
||||
COPY index.html /
|
||||
RUN chmod a+x /run.sh
|
||||
RUN chmod a+x /index.html
|
||||
CMD [ "/run.sh" ]
|
||||
2
apache2-minimal/README.md
Normal file
2
apache2-minimal/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
Have a look at the README for Apache2 full Addon for more informations.
|
||||
[README](https://github.com/FaserF/hassio-addons/blob/master/apache2/README.md)
|
||||
9
apache2-minimal/build.json
Normal file
9
apache2-minimal/build.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "ghcr.io/hassio-addons/base/aarch64:10.0.1",
|
||||
"amd64": "ghcr.io/hassio-addons/base/amd64:10.0.1",
|
||||
"armhf": "ghcr.io/hassio-addons/base/armhf:10.0.1",
|
||||
"armv7": "ghcr.io/hassio-addons/base/armv7:10.0.1",
|
||||
"i386": "ghcr.io/hassio-addons/base/i386:10.0.1"
|
||||
}
|
||||
}
|
||||
42
apache2-minimal/config.json
Normal file
42
apache2-minimal/config.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "Apache2 Minimal",
|
||||
"version": "2.1.1",
|
||||
"slug": "apache2-minimal",
|
||||
"description": "Webserver without PHP and minimal extra modules",
|
||||
"url": "https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal",
|
||||
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
||||
"startup": "application",
|
||||
"boot": "auto",
|
||||
"webui": "[PROTO:ssl]://[HOST]:[PORT:80]",
|
||||
"map": ["share:rw", "media:rw", "ssl"],
|
||||
"ingress": true,
|
||||
"panel_icon": "mdi:web-box",
|
||||
"options": {
|
||||
"document_root": "/share/htdocs",
|
||||
"default_conf": "default",
|
||||
"default_ssl_conf": "default",
|
||||
"website_name":null,
|
||||
"ssl": true,
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem"
|
||||
},
|
||||
"schema": {
|
||||
"document_root":"str",
|
||||
"default_conf":"str",
|
||||
"default_ssl_conf":"str",
|
||||
"website_name":"str",
|
||||
"username":"str?",
|
||||
"password":"str?",
|
||||
"ssl": "bool",
|
||||
"certfile": "str",
|
||||
"keyfile": "str"
|
||||
},
|
||||
"ports": {
|
||||
"80/tcp": 80,
|
||||
"443": 443
|
||||
},
|
||||
"ports_description": {
|
||||
"80/tcp": "Web interface http",
|
||||
"443/tcp": "SSL Web interface"
|
||||
}
|
||||
}
|
||||
BIN
apache2-minimal/icon.png
Normal file
BIN
apache2-minimal/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
284
apache2-minimal/index.html
Normal file
284
apache2-minimal/index.html
Normal file
@@ -0,0 +1,284 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!--
|
||||
Modified from the Debian original for Ubuntu
|
||||
Last updated: 2014-03-19
|
||||
See: https://launchpad.net/bugs/1288690
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Apache2 FaserF Homeassistant Addon Default Page: It works</title>
|
||||
<style type="text/css" media="screen">
|
||||
* {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
body, html {
|
||||
padding: 3px 3px 3px 3px;
|
||||
|
||||
background-color: #D8DBE2;
|
||||
|
||||
font-family: Verdana, sans-serif;
|
||||
font-size: 11pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.main_page {
|
||||
position: relative;
|
||||
display: table;
|
||||
|
||||
width: 800px;
|
||||
|
||||
margin-bottom: 3px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 0px 0px 0px 0px;
|
||||
|
||||
border-width: 2px;
|
||||
border-color: #212738;
|
||||
border-style: solid;
|
||||
|
||||
background-color: #FFFFFF;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.page_header {
|
||||
height: 99px;
|
||||
width: 100%;
|
||||
|
||||
background-color: #F5F6F7;
|
||||
}
|
||||
|
||||
div.page_header span {
|
||||
margin: 15px 0px 0px 50px;
|
||||
|
||||
font-size: 180%;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.page_header img {
|
||||
margin: 3px 0px 0px 40px;
|
||||
|
||||
border: 0px 0px 0px;
|
||||
}
|
||||
|
||||
div.table_of_contents {
|
||||
clear: left;
|
||||
|
||||
min-width: 200px;
|
||||
|
||||
margin: 3px 3px 3px 3px;
|
||||
|
||||
background-color: #FFFFFF;
|
||||
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.table_of_contents_item {
|
||||
clear: left;
|
||||
|
||||
width: 100%;
|
||||
|
||||
margin: 4px 0px 0px 0px;
|
||||
|
||||
background-color: #FFFFFF;
|
||||
|
||||
color: #000000;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.table_of_contents_item a {
|
||||
margin: 6px 0px 0px 6px;
|
||||
}
|
||||
|
||||
div.content_section {
|
||||
margin: 3px 3px 3px 3px;
|
||||
|
||||
background-color: #FFFFFF;
|
||||
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.content_section_text {
|
||||
padding: 4px 8px 4px 8px;
|
||||
|
||||
color: #000000;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
div.content_section_text pre {
|
||||
margin: 8px 0px 8px 0px;
|
||||
padding: 8px 8px 8px 8px;
|
||||
|
||||
border-width: 1px;
|
||||
border-style: dotted;
|
||||
border-color: #000000;
|
||||
|
||||
background-color: #F5F6F7;
|
||||
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.content_section_text p {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
div.content_section_text ul, div.content_section_text li {
|
||||
padding: 4px 8px 4px 16px;
|
||||
}
|
||||
|
||||
div.section_header {
|
||||
padding: 3px 6px 3px 6px;
|
||||
|
||||
background-color: #8E9CB2;
|
||||
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
font-size: 112%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.section_header_red {
|
||||
background-color: #CD214F;
|
||||
}
|
||||
|
||||
div.section_header_grey {
|
||||
background-color: #9F9386;
|
||||
}
|
||||
|
||||
.floating_element {
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.table_of_contents_item a,
|
||||
div.content_section_text a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.table_of_contents_item a:link,
|
||||
div.table_of_contents_item a:visited,
|
||||
div.table_of_contents_item a:active {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.table_of_contents_item a:hover {
|
||||
background-color: #000000;
|
||||
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
div.content_section_text a:link,
|
||||
div.content_section_text a:visited,
|
||||
div.content_section_text a:active {
|
||||
background-color: #DCDFE6;
|
||||
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.content_section_text a:hover {
|
||||
background-color: #000000;
|
||||
|
||||
color: #DCDFE6;
|
||||
}
|
||||
|
||||
div.validator {
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main_page">
|
||||
<div class="page_header floating_element">
|
||||
<span class="floating_element">
|
||||
Apache2 FaserF Homeassistant Addon Default Page
|
||||
</span>
|
||||
</div>
|
||||
<!-- <div class="table_of_contents floating_element">
|
||||
<div class="section_header section_header_grey">
|
||||
TABLE OF CONTENTS
|
||||
</div>
|
||||
<div class="table_of_contents_item floating_element">
|
||||
<a href="#about">About</a>
|
||||
</div>
|
||||
<div class="table_of_contents_item floating_element">
|
||||
<a href="#changes">Changes</a>
|
||||
</div>
|
||||
<div class="table_of_contents_item floating_element">
|
||||
<a href="#scope">Scope</a>
|
||||
</div>
|
||||
<div class="table_of_contents_item floating_element">
|
||||
<a href="#files">Config files</a>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="content_section floating_element">
|
||||
|
||||
|
||||
<div class="section_header section_header_red">
|
||||
<div id="about"></div>
|
||||
It works!
|
||||
</div>
|
||||
<div class="content_section_text">
|
||||
<p>
|
||||
This is the default welcome page used to test the correct
|
||||
operation of the Apache2 server after the installation of the Homeassistant Addon.
|
||||
If you can read this page, it means that the Apache HTTP server installed at
|
||||
this site is working properly. You should <b>replace this file</b> (located at
|
||||
<tt>/share/htdocs/index.html</tt>) before continuing to operate your HTTP server.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
If you are a normal user of this web site and don't know what this page is
|
||||
about, this probably means that the site is currently unavailable due to
|
||||
maintenance.
|
||||
If the problem persists, please contact the site's administrator.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="section_header">
|
||||
<div id="changes"></div>
|
||||
Configuration Overview
|
||||
</div>
|
||||
<div class="content_section_text">
|
||||
<p>
|
||||
The configuration system is <b>fully documented in
|
||||
the github repository</b>. Refer to this for the full
|
||||
documentation. Documentation can be
|
||||
found by accessing the <a href="https://github.com/FaserF/hassio-addons/tree/master/apache2">manual</a>.
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="section_header">
|
||||
<div id="bugs"></div>
|
||||
Reporting Problems
|
||||
</div>
|
||||
<div class="content_section_text">
|
||||
<p>
|
||||
Please use the <tt>github issues tracker</tt> tool to report bugs in the
|
||||
Apache2 Addon with Homeassistant. However, check <a
|
||||
href="https://github.com/FaserF/hassio-addons/issues">existing
|
||||
bug reports</a> before reporting a new bug.
|
||||
</p>
|
||||
<p>
|
||||
Please report bugs specific to modules (such as PHP and others)
|
||||
to respective packages, not to the web server itself.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="validator">
|
||||
<p>
|
||||
<a href="https://validator.w3.org/check?uri=referer"><img src="https://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
166
apache2-minimal/run.sh
Normal file
166
apache2-minimal/run.sh
Normal file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env bashio
|
||||
ssl=$(bashio::config 'ssl')
|
||||
website_name=$(bashio::config 'website_name')
|
||||
certfile=$(bashio::config 'certfile')
|
||||
keyfile=$(bashio::config 'keyfile')
|
||||
DocumentRoot=$(bashio::config 'document_root')
|
||||
phpini=$(bashio::config 'php_ini')
|
||||
username=$(bashio::config 'username')
|
||||
password=$(bashio::config 'password')
|
||||
default_conf=$(bashio::config 'default_conf')
|
||||
default_ssl_conf=$(bashio::config 'default_ssl_conf')
|
||||
webrootdocker=/var/www/localhost/htdocs/
|
||||
|
||||
if [ $phpini = "get_file" ]; then
|
||||
cp /etc/php7/php.ini /share/apache2addon_php.ini
|
||||
echo "You have requestet a copy of the php.ini file. You will now find your copy at /share/apache2addon_php.ini"
|
||||
echo "Addon will now be stopped. Please remove the config option and change it to the name of your new config file (for example /share/php.ini)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -r $webrootdocker
|
||||
|
||||
if [ ! -d $DocumentRoot ]; then
|
||||
echo "You haven't put your website to $DocumentRoot"
|
||||
echo "A default website will now be used"
|
||||
mkdir $webrootdocker
|
||||
cp /index.html $webrootdocker
|
||||
else
|
||||
#Create Shortcut to shared html folder
|
||||
ln -s $DocumentRoot /var/www/localhost/htdocs
|
||||
fi
|
||||
|
||||
#Set rights to web folders and create user
|
||||
find $DocumentRoot -type d -exec chmod 771 {} \;
|
||||
if [ ! -z "$username" ] && [ ! -z "$password" ] && [ ! $username = "null" ] && [ ! $password = "null" ]; then
|
||||
adduser -S $username -G www-data
|
||||
echo "$username:$password" | chpasswd $username
|
||||
find $webrootdocker -type d -exec chown $username:www-data -R {} \;
|
||||
find $webrootdocker -type f -exec chown $username:www-data -R {} \;
|
||||
else
|
||||
echo "No username and/or password was provided. Skipping account set up."
|
||||
fi
|
||||
|
||||
if [ $phpini != "default" ]; then
|
||||
if [ -f $phpini ]; then
|
||||
echo "Your custom php.ini at $phpini will be used."
|
||||
rm /etc/php7/php.ini
|
||||
cp $phpini /etc/php7/php.ini
|
||||
else
|
||||
echo "You have changed the php_ini variable, but the new file could not be found! Default php.ini file will be used instead."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $ssl = "true" ] && [ $default_conf = "default" ]; then
|
||||
echo "You have activated SSL. SSL Settings will be applied"
|
||||
if [ ! -f /ssl/$certfile ]; then
|
||||
echo "Cannot find certificate file $certfile"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f /ssl/$keyfile ]; then
|
||||
echo "Cannot find certificate key file $keyfile"
|
||||
exit 1
|
||||
fi
|
||||
mkdir /etc/apache2/sites-enabled
|
||||
sed -i '/LoadModule rewrite_module/s/^#//g' /etc/apache2/httpd.conf
|
||||
echo "Listen 8099" >> /etc/apache2/httpd.conf
|
||||
echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
echo "#Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo " RewriteEngine On" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo " RewriteCond %{HTTPS} off" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo " RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "#End Redirect http to https" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
echo "<IfModule mod_ssl.c>" > /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "<VirtualHost *:443>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "ServerName $website_name" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "ServerAdmin webmaster@localhost" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "DocumentRoot $webrootdocker" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
|
||||
echo " ErrorLog /var/log/error.log" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo " #CustomLog /var/log/access.log combined" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "SSLCertificateFile /ssl/$certfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "SSLCertificateKeyFile /ssl/$keyfile" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "</IfModule>" >> /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
else
|
||||
echo "SSL is deactivated and/or you are using a custom config."
|
||||
fi
|
||||
if [ "$ssl" = "true" ] || [ "$default_conf" != "default" ]; then
|
||||
echo "Include /etc/apache2/sites-enabled/*.conf" >> /etc/apache2/httpd.conf
|
||||
fi
|
||||
|
||||
sed -i -e '/AllowOverride/s/None/All/' /etc/apache2/httpd.conf
|
||||
|
||||
if [ "$default_conf" = "get_config" ]; then
|
||||
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
|
||||
if [ ! -d /etc/apache2/sites-enabled ]; then
|
||||
mkdir /etc/apache2/sites-enabled
|
||||
fi
|
||||
cp /etc/apache2/sites-enabled/000-default.conf /share/000-default.conf
|
||||
echo "You have requested a copy of the apache2 config. You can now find it at /share/000-default.conf ."
|
||||
fi
|
||||
if [ -f /etc/apache2/httpd.conf ]; then
|
||||
cp /etc/apache2/httpd.conf /share/httpd.conf
|
||||
echo "You have requested a copy of the apache2 config. You can now find it at /share/httpd.conf ."
|
||||
fi
|
||||
if [ "$default_ssl_conf" != "get_config" ]; then
|
||||
echo "Exiting now..."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! $default_conf =~ ^(default|get_config)$ ]]; then
|
||||
if [ -f $default_conf ]; then
|
||||
if [ ! -d /etc/apache2/sites-enabled ]; then
|
||||
mkdir /etc/apache2/sites-enabled
|
||||
fi
|
||||
if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
|
||||
rm /etc/apache2/sites-enabled/000-default.conf
|
||||
fi
|
||||
cp -rf $default_conf /etc/apache2/sites-enabled/000-default.conf
|
||||
echo "Your custom apache config at $default_conf will be used."
|
||||
else
|
||||
echo "Cant find your custom 000-default.conf file $default_conf - be sure you have choosen the full path. Exiting now..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$default_ssl_conf" = "get_config" ]; then
|
||||
if [ -f /etc/apache2/httpd.conf ]; then
|
||||
cp /etc/apache2/sites-enabled/000-default-le-ssl.conf /share/000-default-le-ssl.conf
|
||||
echo "You have requested a copy of the apache2 ssl config. You can now find it at /share/000-default-le-ssl.conf ."
|
||||
fi
|
||||
echo "Exiting now..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$default_ssl_conf" != "default" ]; then
|
||||
if [ -f $default_ssl_conf ]; then
|
||||
if [ ! -d /etc/apache2/sites-enabled ]; then
|
||||
mkdir /etc/apache2/sites-enabled
|
||||
fi
|
||||
if [ -f /etc/apache2/sites-enabled/000-default-le-ssl.conf ]; then
|
||||
rm /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
fi
|
||||
cp -rf $default_ssl_conf /etc/apache2/sites-enabled/000-default-le-ssl.conf
|
||||
echo "Your custom apache config at $default_ssl_conf will be used."
|
||||
else
|
||||
echo "Cant find your custom 000-default-le-ssl.conf file $default_ssl_conf - be sure you have choosen the full path. Exiting now..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Here is your web file architecture."
|
||||
ls -l $webrootdocker
|
||||
|
||||
echo "Starting Apache2..."
|
||||
exec /usr/sbin/httpd -D FOREGROUND
|
||||
Reference in New Issue
Block a user