This commit is contained in:
2021-08-24 14:35:11 +03:00
parent d8fba9335d
commit 4f37cb59b1
107 changed files with 3941 additions and 66 deletions

84
apache2/CHANGELOG.md Normal file
View File

@@ -0,0 +1,84 @@
# Changelog
## 2.1.1
- bump hassio-addon-base to V10.0.1
## 2.1.0
- bump hassio-addon-base to V10.0.0
- fixed an issue in the php7-locales which resulted in an issue while installing the addon
## 2.0.4
- add php7-ctype support
## 2.0.3
- Enable Apache Foreground Logging
## 2.0.2
- ability to set a username and password to access the webfiles
## 2.0.1
- add php7-locales support
- add Mosquitto-PHP support
## 2.0.0
- add php7-xml support
- this addon is now available in three variants:
Minimal
Minimal with MariaDB
this "normal" version with common used PHP Modules
## 1.7.2
- fixed error: can't find custom config
## 1.7.1
- fixed error: can't find custom web root folder
## 1.7.0
- add php7-session php7-intl php7-soap php7-session php7-fileinfo support
## 1.6.0
- add php7-iconv and php7-dom support
## 1.5.1
- add option to recieve a apache2 config copy
- fix PHP7-PDO syntax error in Dockerfile
## 1.5.0
- add PHP7-PDO package
## 1.4.0
- allow the usage of custom apache2 config files
## 1.3.0
- allow the usage of a custom php.ini file
## 1.2.3
- add /media folder as a root folder option
## 1.2.2
- hotfix update for ssl path not working
## 1.2.1
- enabled use of .htaccess files
## 1.2.0
- new option document_root -> Allowing the user to decide the document root folder
- added default index.html if the user has no webfiles in the correct folder
## 1.1.2
- added php-mcrypt, php-zip
- Ingress is now supported
## 1.1.1
- added mariadb-client to docker image
## 1.1.0
- New Icon
- Prepared Ingress Support
## 1.0.1
- Fixed SSL
- Removed MariaDB Options
## 1.0.0
- Initial release

41
apache2/Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
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 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
RUN apk --no-cache add php7 php7-dev php7-fpm php7-mysqli php7-opcache php7-gd php7-zlib php7-curl php7-phar php7-json php7-mbstring php7-mcrypt php7-zip php7-pdo php7-pdo_mysql php7-iconv php7-dom php7-session php7-intl php7-soap php7-fileinfo php7-xml php7-ctype
RUN apk --no-cache add mosquitto mosquitto-dev
RUN apk --no-cache add mariadb-client
#musl-locales/php7-locales
RUN apk add --no-cache cmake make musl-dev gcc gettext-dev libintl
RUN wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
&& unzip musl-locales-master.zip \
&& cd musl-locales-master \
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
&& cd .. && rm -r musl-locales-master
#Mosquitto-PHP
RUN wget https://github.com/mgdm/Mosquitto-PHP/archive/refs/heads/master.zip \
&& unzip master.zip \
&& cd Mosquitto-PHP-master \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& cd .. && rm -r Mosquitto-PHP-master
#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" ]

175
apache2/README.md Normal file
View File

@@ -0,0 +1,175 @@
# Home Assistant Community Add-on: Apache2
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]
![Project Maintenance][maintenance-shield]
Apache2 Webserver for Homeassistant OS
![Ingress Support](images/ingress.png)
## About
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.<br />
The Apache HTTP Server ("httpd") was launched in 1995 and it has been the most popular web server on the Internet since April 1996. It has celebrated its 25th birthday as a project in February 2020.<br />
The Apache HTTP Server is a project of The Apache Software Foundation.
## Different Versions
### Full Version
The [full Apache2 Version](https://github.com/FaserF/hassio-addons/tree/master/apache2) with MariaDB and common used PHP modules. <br />
This docker image comes with: apache2 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl mariadb-client<br />
The following php7 extensions will be installed: php7 php7-dev php7-fpm php7-mysqli php7-opcache php7-gd php7-zlib php7-curl php7-phar php7-json php7-mbstring php7-mcrypt php7-zip php7-pdo php7-pdo_mysql php7-iconv php7-dom php7-session php7-intl php7-soap php7-fileinfo php7-xml<br />
And it comes with php7 locales and [Mosquitto-PHP](https://github.com/mgdm/Mosquitto-PHP).
### Minimal Version
The [Minimal Version](https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal) of the Apache2 Addon without MariaDB and with no PHP modules. <br />
This docker image comes with: apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl
### Minimal Version with MariaDB
The [Minimal Version with MariaDB and some PHP modules](https://github.com/FaserF/hassio-addons/tree/master/apache2-minimal-mariadb) of the Apache2 Addon. <br />
This docker image comes with: apache2 php7-apache2 libxml2-dev apache2-utils apache2-mod-wsgi apache2-ssl mariadb-client<br />
The following php7 extensions will be installed: php7 php7-mysqli php7-opcache php7-curl php7-json php7-mbstring php7-mcrypt php7-zip
## Installation
[![FaserF Homeassistant Addons](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FFaserF%2Fhassio-addons)
<br />
The installation of this add-on is pretty straightforward and not different in comparison to installing any other custom Home Assistant add-on.<br />
Just click the link above or add my repo to the hassio addons repositorys: https://github.com/FaserF/hassio-addons
Put your website files to /share/htdocs<br />
Example File where your index.html should be: /share/htdocs/index.html <br />
If you want to integrate your website with a mariadb database. Please ensure that the MariaDB Addon is installed!
## Configuration
**Note**: _Remember to restart the add-on when the configuration is changed._
Example add-on configuration:
```yaml
document_root: /media/apache2
php_ini: /share/apache2/php.ini
default_conf: /share/apache2/000-default.conf
default_ssl_conf: get_file
website_name: itdoesntmatter_as_ssl_is_set_to_false
username: apache
password: mySecretPassword
ssl: false
certfile: itdoesntmatter_as_ssl_is_set_to_false
keyfile: itdoesntmatter_as_ssl_is_set_to_false
```
<br />
Recommended Example add-on configuration:
```yaml
document_root: /share/htdocs
php_ini: default
default_conf: default
default_ssl_conf: default
website_name: mywebsite.ddns.net
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
```
**Note**: _This is just an example, don't copy and paste it! Create your own!_
### Option: `document_root`
This option is needed. Change it depending where your root webfolder is on your homeassistant installation.
Note: it has to be somewhere in the /share or /media folder! Other folders are not visible to this addon.
### Option: `php_ini`
You can choose between the following options:
default -> the default php7 php.ini file will be used
get_file -> copies the default php7 php.ini file from the addon to /share/apache2addon_php.ini
path/to/your/new/php.ini -> Please change the location depending where your custom php.ini file is, f.e.: /share/apache2/php.ini
### Option: `default_conf` & `default_ssl_conf`
You can choose between the following options:
default -> the default apache2 addon file will be used
get_config -> Get a copy of the default apache2 addon config file to your /share folder.
path/to/your/new/apache2.conf -> Please change the location depending where your custom 000-default.conf / 000-default-le-ssl.conf file is, f.e.: /share/apache2/000-default.conf <br />
More Information: https://cwiki.apache.org/confluence/display/HTTPD/ExampleVhosts<br /> <br />
Please note, that I wont give any support if you are using custom apache2 config files and are recieving any apache2 errors!
### Option: `website_name`
This option is needed, if you enable ssl to true. If you are not using SSL put anything in here, as it doesnt matter.
### Option: `username`
This option is optional. Set a username to access the webfiles.
### Option: `password`
This option is optional. Set a password to access the webfiles.
### Option: `ssl`
Enables/Disables SSL (HTTPS) on the web interface. Set it `true` to enable it, `false` otherwise.
If you need a self-signed certificate, have a look at my openssl addon: https://github.com/FaserF/hassio-addons/tree/master/openssl
**Note**: _The files MUST be stored in `/ssl/`, which is the default_
## Ingress
This addon supports Homeassistant Ingress. Until now it seems only to work if you enable SSL!
And also I am sorry, but I cant support all your websites. Basic HTML Websites will work great with ingress, the more advanced the page is, the harder it is to support ingress.
## Support
Got questions or problems?
You can [open an issue here][issue] GitHub.
Please keep in mind, that this software is only tested on armv7 running on a Raspberry Pi 4.
## Authors & contributors
The original program is from the Apache Project. For more informatios please visit this page: https://httpd.apache.org/
The hassio addon is brought to you by [FaserF].
## License
MIT License
Copyright (c) 2019-2021 FaserF & The Apache Project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
[FaserF]: https://github.com/FaserF/
[issue]: https://github.com/FaserF/hassio-addons/issues

9
apache2/build.json Normal file
View 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"
}
}

44
apache2/config.json Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "Apache2",
"version": "2.1.1",
"slug": "apache2",
"description": "OpenSource Webserver",
"url": "https://github.com/FaserF/hassio-addons/tree/master/apache2",
"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",
"php_ini": "default",
"default_conf": "default",
"default_ssl_conf": "default",
"website_name":null,
"ssl": true,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
},
"schema": {
"document_root":"str",
"php_ini":"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/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
apache2/images/ingress.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

284
apache2/index.html Normal file
View 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>

168
apache2/run.sh Normal file
View File

@@ -0,0 +1,168 @@
#!/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
else
echo "extension=mosquitto.so" >> /etc/php7/php.ini
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