Skip to content

Instantly share code, notes, and snippets.

@dimm999
Created December 2, 2018 14:14
Show Gist options
  • Save dimm999/b35b470f5f4ab3ea47ede11e747abfd3 to your computer and use it in GitHub Desktop.
Save dimm999/b35b470f5f4ab3ea47ede11e747abfd3 to your computer and use it in GitHub Desktop.
wordpress + Nginx + PHP 7.2 + Cloudflare (SSL)
server {
listen 80;
listen [::]:80;
server_name site.com www.site.com;
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl on;
ssl_certificate /etc/nginx/ssl/site.com.pem;
ssl_certificate_key /etc/nginx/ssl/site.com.key;
server_name site.com www.site.com;
root /var/www/site.com;
index index.php index.html index.htm;
access_log /var/log/nginx/site.com.access.log;
error_log /var/log/nginx/site.com.error.log;
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;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
@dimm999
Copy link
Author

dimm999 commented Dec 2, 2018

don't forget into Cloudflare pannel enable https full and enable autoredirect to https

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment