Last active
June 7, 2022 19:00
-
-
Save emiliodallatorre/ab97aebefee0b6af7dbca6a781ff0aaf to your computer and use it in GitHub Desktop.
Empty Nginx web server configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# server { | |
# listen 80; | |
# server_name yourhostname.it www.yourhostname.it; | |
# return 301 https://yourhostname.it$request_uri; | |
# } | |
server { | |
# listen 443 ssl; # managed by Certbot | |
# ssl_certificate /etc/letsencrypt/live/yourhostname.it/fullchain.pem; # managed by Certbot | |
# ssl_certificate_key /etc/letsencrypt/live/yourhostname.it/privkey.pem; # managed by Certbot | |
# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
listen 80; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
server_name yourhostname.it www.yourhostname.it; | |
client_max_body_size 100M; | |
location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ { | |
if ($http_accept !~* "image/webp") { | |
break; | |
} | |
add_header Vary Accept; | |
add_header Cache-Control "private" always; | |
expires 365d; | |
try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404; | |
} | |
location / { | |
# try_files $uri $uri/ =404; | |
try_files $uri $uri/ /index.php$is_args$args; | |
# try_files $uri $uri/ /index.php?$args; | |
# index index.html index.htm index.php; | |
# rewrite ^/(.*)$ /index.php?$1; | |
# index index.html index.htm index.php; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
include fastcgi_params; | |
fastcgi_pass unix:/var/run/php/php-fpm.sock; | |
fastcgi_connect_timeout 300s; | |
fastcgi_read_timeout 300s; | |
fastcgi_send_timeout 300s; | |
fastcgi_intercept_errors on; | |
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; | |
} | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment