Skip to content

Instantly share code, notes, and snippets.

@geekykant
Created May 19, 2020 11:33
Show Gist options
  • Save geekykant/281d52a163b740a47d32272a3520745d to your computer and use it in GitHub Desktop.
Save geekykant/281d52a163b740a47d32272a3520745d to your computer and use it in GitHub Desktop.
Cloudflare + Nginx (DigitalOcean Setup)
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 ssl; #Make sure to set SSL to (Strict) in Clouflare menu
root /var/www/html;
index index.php;
server_name example.com www.example.com;
#Configure this cloudflare Certificates
ssl_certificate /etc/ssl/cloudflare/cert.pem;
ssl_certificate_key /etc/ssl/cloudflare/key.pem;
#Wordpress config (PHP7.2)
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment