Skip to content

Instantly share code, notes, and snippets.

@PythonCoderAS
Created May 9, 2022 22:15
Show Gist options
  • Select an option

  • Save PythonCoderAS/189b1e686cb2977b5f0915a0f08c671b to your computer and use it in GitHub Desktop.

Select an option

Save PythonCoderAS/189b1e686cb2977b5f0915a0f08c671b to your computer and use it in GitHub Desktop.
Configuration for wordpress site located at /var/www/wordpress
server {
listen 0.0.0.0:443 http2;
listen [::]:443 http2;
server_name <url>; # Fixme!
ssl on;
ssl_certificate /etc/nginx/certificate.pem;
ssl_certificate_key /etc/nginx/certificate.key;
root /var/www/wordpress;
index index.html index.php;
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;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment