Skip to content

Instantly share code, notes, and snippets.

@dimawebmaker
Created December 2, 2018 14:14
Show Gist options
  • Save dimawebmaker/b35b470f5f4ab3ea47ede11e747abfd3 to your computer and use it in GitHub Desktop.
Save dimawebmaker/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;
}
}
@dimawebmaker
Copy link
Author

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