https://github.com/omarchehab98/nginx-recipes-for-the-lazy
Copy-paste ready Nginx configuration for static sites, reverse proxy, single page web apps, php, wordpress, ...
https://github.com/omarchehab98/nginx-recipes-for-the-lazy
Last synced: 22 days ago
JSON representation
Copy-paste ready Nginx configuration for static sites, reverse proxy, single page web apps, php, wordpress, ...
- Host: GitHub
- URL: https://github.com/omarchehab98/nginx-recipes-for-the-lazy
- Owner: omarchehab98
- Created: 2018-12-06T21:44:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-31T08:28:32.000Z (almost 5 years ago)
- Last Synced: 2025-03-08T21:03:13.145Z (3 months ago)
- Homepage:
- Size: 12.7 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nginx Recipes For The Lazy
Tested on Ubuntu 16.04 and 18.04
## Static Server
[`static.conf`](sites-available/static.conf)
## Static Server for Clientside Routers (React, Angular, Vue.js, ...)
[`spwa.conf`](sites-available/spwa.conf)
## HTTP Proxy Server (Node.js, Python, ...)
[`proxy.conf`](sites-available/proxy.conf)
## PHP Proxy Server
[`php.conf`](sites-available/php.conf)
## WordPress Server
[`wordpress.conf`](sites-available/wordpress.conf)
# SSL
LetsEncrypt [certbot.eff.org](https://certbot.eff.org/)
`/etc/ssl/certs/dhparam.pem`
```sh
openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
````/etc/ssl/certs/ssl-cert-snakeoil.pem`
`/etc/ssl/private/ssl-cert-snakeoil.key`
```sh
make-ssl-cert generate-default-snakeoil --force-overwrite
```## Wildcard Certificate with Cloudflare
```sh
certbot certonly \
--preferred-challenges dns-01 \
--dns-cloudflare --dns-cloudflare-credentials /root/.cloudflare.ini \
-d 'example.com,*.example.com'# Renewal
certbot renew \
--dns-cloudflare --dns-cloudflare-credentials /root/.cloudflare.ini \
--pre-hook "systemctl stop nginx" \
--post-hook "systemctl start nginx"
# REMINDER: --dry-run
````/root/.cloudflare.ini`
```ini
dns_cloudflare_email = "[email protected]"
dns_cloudflare_api_key = "abcdefghijklmnopqrstuvwxyz0"
```