This is an example of how to configure nginx for a simple, tiny, homemade SSO system. I'm using a similar configuration for all my side projects hosted in AWS.
Based on this post from Shopware.
- nginx: Distributes all the incoming requests between the auth service and other applications.
- site: An application that needs to be secured, it returns the request as an HTML page. This service is not aware of users or credentials.
- auth: The SSO authentication service. Provides a login page, authenticate and logout methods. Also a REST API to retrieve users.
- Docker
- Docker compose
- Go
- Make
$ make build
$ docker-compose up
Then, go to your favorite browser and open this. Nginx is configured
to redirect all traffic to site
, but first it tries to authenticate the request with auth
. When
no authentication is provided, it redirects the request to the login page.
Links: