server {
root /var/www/images;
index index.html index.htm index.nginx-debian.html;
server_name images.nunosempere.com;
location / {
# First attempt to serve request as file, then# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbotlisten443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/images.nunosempere.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/images.nunosempere.com/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
}
server {
if ($host = images.nunosempere.com) {
return301 https://$host$request_uri;
} # managed by Certbotlisten80;
listen [::]:80;
server_name images.nunosempere.com;
return404; # managed by Certbot
}
I host my own images on my server using nginx to serve them from /var/www/images. You can see an example here: https://images.nunosempere.com/blog/2023/02/19/bayesian-adjustment-to-rethink-priorities-welfare-range-estimates/ignore-the-prior.png
The nginx configuration I’m using is
server { root /var/www/images; index index.html index.htm index.nginx-debian.html; server_name images.nunosempere.com; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/images.nunosempere.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/images.nunosempere.com/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 } server { if ($host = images.nunosempere.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name images.nunosempere.com; return 404; # managed by Certbot }