Docker Apache [0%]
For the Captive Page we can use a plain apache docker image.
Apache with a Dockerfile
FROM php:7.2-apache
COPY src/ /var/www/html/
$ docker build -t cappage .
$ docker run -d --name cappage-app cappage
1718 sudo docker run -d -p 4000:80 --name cappage-app -v /home/franz/lamp/wifi-portal/public/:/var/www/html php:7.2-apache
1744 sudo docker run -d -p 4000:80 --name cappage-app --user 33 -v /home/franz/lamp/wifi-portal/public/:/var/www/html php:7.2-apache
1745 docker exec -it cappage-app bash
1746 sudo docker stop cappage-app
1747 sudo docker rm cappage-app
1748 sudo docker run -d -p 4000:80 --name cappage-app --user 0 -v /home/franz/lamp/wifi-portal/public/:/var/www/html php:7.2-apache
1749 docker exec -it cappage-app bash
Download Composer Latest: v2.7.2
To quickly install Composer in the current directory, run the following script in your terminal. To automate the installation, use the guide on installing Composer programmatically.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
This installer script will simply check some php.ini
settings, warn you if they are set incorrectly, and then download the latest composer.phar
in the current directory. The 4 lines above will, in order:
- Download the installer to the current directory
- Verify the installer SHA-384, which you can also cross-check here
- Run the installer
- Remove the installer
Most likely, you want to put the composer.phar
into a directory on your PATH, so you can simply call composer
from any directory (Global install), using for example: sudo mv composer.phar /usr/local/bin/composer
Follow the Instructions in the README.md
# OpenWRT Coova Chilli External Captive Portal
The following actions are required to use the code given in this repo:
## Portal Setup Using Git
Suppose your domain is `hotspot.example.com`. It can be setup like this:
```
cd /var/www
git clone https://github.com/nasirhafeez/openwrt-yt-portal
mv openwrt-yt-portal hotspot.example.com
cd /var/www/hotspot.example.com
```
Copy the `.env.example` file to `.env` and set the values of the given environment variables in it:
```
cp .env.example .env
nano .env
```
Navigate to public folder:
`cd /var/www/hotspot.example.com/public`
Use [this](https://getcomposer.org/download/) link to install Composer. Then run `php composer.phar install` to install the packages given in `composer.json`.
## Apache Virtual Hosts
Apache virtual host can be setup on the portal server using the instructions given [here](https://gist.github.com/nasirhafeez/d47c9d68742227a23f1011455a190490#apache-site-setup).
The portal files are in public folder in this repository. DocumentRoot will be:
`/var/www/hotspot.example.com/public`
For the Captiva Page Database I am using phpmyadmin docker image
Example docker-compose.yml
for phpmyadmin
:
version: '3.1'
services:
db:
image: mariadb:10.6
restart: always
ports:
- 4306:3306
environment:
MYSQL_ROOT_PASSWORD: notSecureChangeMe
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- 8080:80
environment:
- PMA_ARBITRARY=1
~/phpmyadmin$ sudo docker compose -f ./docker-compose.yml start
~/phpmyadmin$ sudo docker inspect phpmyadmin_default
[
{
"Name": "phpmyadmin_default",
"Subnet": "172.19.0.0/16",
"Gateway": "172.19.0.1"
"Name": "phpmyadmin-phpmyadmin-1",
"IPv4Address": "172.19.0.3/16",
},
"Name": "phpmyadmin-db-1",
"IPv4Address": "172.19.0.2/16",
}
},
]
1767 sudo docker compose -f ./docker-compose.yml up
1768 sudo vi docker-compose.yml
1769 sudo docker compose -f ./docker-compose.yml start
1770 ls
1771 sudo docker compose -f ./docker-compose.yml stop
1772 sudo docker compose -f ./docker-compose.yml rm