A collection of bash scripts to manage an nginx docker container acting as a reverse proxy to other containers.
For convenience, install the main script into your bin directory:
sudo ln -s `pwd`/scripts/nginx-agora.sh /usr/bin/nginx-agoraThe following operations are supported:
startStarts and creates nginx-agora container and network.restartRestarts nginx-agora running container.installInstalls a new website. This command takes the path to the nginx config file, the root folder of the website and an optional name. This name will be used for mounting the root folder into the container under/var/www/{name}.install-proxyThe same asinstall, but this will not mount any folder into the nginx-agora container. This is intended for sites where nginx-agora is only a proxy and all requests, including static assets, are handled by the site container.uninstallRemoves a site.enableEnables a site for serving.disableDisables a site for serving.stopStop nginx-agora running container.statusDisplay nginx-agora container status.
A network with the name nginx-agora will be created, and containers to be exposed should be attached to this network.
To learn more how this all works I suggest looking at the actual scripts.
To get started with a bare-bones example, execute the following commands from the example_html folder on the cloned repository.
nginx-agora install example.test.conf ./
nginx-agora enable
nginx-agora startRemember to add the example.test domain to your /etc/hosts file.
Now visit http://example.test in your browser and that should work!
This is a more realistic scenario, where you'd have a project using docker-compose. Execute the following commands from the example_php folder on the cloned repository.
docker-compose up -d
nginx-agora install example.test.conf ./
nginx-agora enable
nginx-agora startIf you didn't do it in the already, add the example.test domain to your /etc/hosts file.
Now visit http://example.test in your browser and you should see the output from the php script using phpinfo!
These scripts were created for my own use case, and are intended for advanced users who are already familiar with docker and nginx and just want a starting point. Or for others learning how to setup their own server using docker and nginx. But I wouldn't recommend using this in production without looking at the scripts (they are very short!).
If you are looking for a more comprehensive and hands-off alternative, take a look at nginx-proxy.