Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aloskutov/nginx-ssl-php-db


https://github.com/aloskutov/nginx-ssl-php-db

adminer docker docker-compose localhost mariadb nginx php-fpm postgres postgresql ssl

Last synced: 13 days ago
JSON representation

Awesome Lists containing this project

README

        

# nginx-ssl-php-db
Local development environment: nginx + SSL + php + mariadb + adminer

## Project tree


├───conf
│ ├───certs
│ ├───mariadb
│ ├───nginx
│ │ └───conf.d
│ └───php
├───logs
│ ├───mariadb
│ ├───nginx
│ └───php
├───mariadb
└───src

## Docker Images
+ [PHP:fpm-alpine](https://hub.docker.com/_/php)
+ [MariaDB](https://hub.docker.com/_/mariadb)
+ [Nginx:alpine](https://hub.docker.com/_/nginx)
+ [Adminer](https://hub.docker.com/_/adminer)

This project use the following ports:

| Server | Port |
|------------|------|
| MariaDB | 3306 |
| Adminer | 8080 |
| Nginx | 80 |
| Nginx SSL | 433 |
| PHP-FPM | 9000 |

# SSL for localhost

Install mkcert.

```shell
choco install mkcert
```

Install RootCA
```shell
mkcert -install
```

Create certificates for localhost (or other hostname)
```shell
mkcert localhost
```

Copy them to /conf/certs and change nginx [config](conf/nginx/localhost.conf) options ssl_certificate and ssl_certificate_key
```nginx
ssl_certificate /etc/nginx/certs/localhost.pem;
ssl_certificate_key /etc/nginx/certs/localhost-key.pem;
```

## Set localhost certificates in Firefox

Manually install the rootCA in firefox through firefox's cert manager (If it is not listed). Prefences -> Privacy & Security -> Certificates -> View Certificates -> Authorities (Tab) -> Import

![Firefox Certificate Manager](firefox-1.png)

Select certificate and set trust settings "Edit Trust..." -> set "This certificate can identify websites." -> ok

![Edit CA certificate trust settings](firefox-2.png)

---

- [How to Get HTTPS Working in Windows 10 Localhost Dev Environment](https://zeropointdevelopment.com/how-to-get-https-working-in-windows-10-localhost-dev-environment/)
- [How to create an HTTPS certificate for localhost domains](https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8)
- [How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)](https://gist.github.com/cecilemuller/a26737699a7e70a7093d4dc115915de8)