nginx server 404 not found when convert test images
-
Hello I have tried method 1 and 2 from the FAQ about Nginx server but can’t get webp express to work, when I convert test image after configuration, I got a 404 not found.
It’s a classic wp installation on ubuntu 18.04 nginx server on digitalocean.
My file /etc/nginx/sites-available looks like:`server {
root /var/www/mysite.be;
index index.php index.html index.htm index.nginx-debian.html;
server_name mysite.be https://www.mysite.be;location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}location ~ /\.ht {
deny all;
}location = /favicon.ico { log_not_found off; access_log off;
}location ~* ^/wp-content/.*\.(png|jpe?g)$ {
add_header Vary Accept;
expires 365d;
}
location ~* ^/wp-content/.*\.webp$ {
expires 365d;
if ($whattodo = AB) {
expires 365d;
if ($whattodo = AB) {
add_header Vary Accept;
}
}
if ($http_accept ~* “webp”){
set $whattodo A;
}
if (-f $request_filename.webp) {
set $whattodo “${whattodo}B”;
}
if ($whattodo = AB) {
rewrite ^(.*) $1.webp last;
}
if ($whattodo = A) {
rewrite ^/wp-content/.*\.(jpe?g|png)$ /wp-content/plugins/webp-express/w$
}
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;
}listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mysite.be/fullchain.pem; # managed$
ssl_certificate_key /etc/letsencrypt/live/mysite.be/privkey.pem; # manag$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot}
server {
if ($host = https://www.mysite.be) {
return 301 https://$host$request_uri;
} # managed by Certbotif ($host = mysite.be) {
return 301 https://$host$request_uri;
} # managed by Certbotif ($http_accept ~* “webp”){
rewrite ^/(.*).(jpe?g|png)$ /wp-content/plugins/webp-express/wod/webp-on-de$
}listen 80;
server_name mysite.be https://www.mysite.be;
return 404; # managed by Certbot}
`
What to do to get it to work ?
- The topic ‘nginx server 404 not found when convert test images’ is closed to new replies.