ubuntu + nginx – everything works except “rewrite url structure” [closed]

W3 Total cache generates a nginx.conf file in the root of your blog.

you need to include that file in your nginx configuration file, for W3 Total cache to work properly.

For example if your file is in the /etc/nginx/sites-available/MyWordPress

then edit that file to include your blogs nginx.conf generated by W3 Total Cache in the Server block.

    server {
        listen 80;
        listen [::]:80;

        root /var/www/MyWordPress;
        index index.php index.html index.htm;

       include /var/www/MyWordPress/nginx.conf;
    }

you just need to include the last line.

Update :

nginx.conf generated by W3 Total Cache contains the below rewrite code for Minify :

# BEGIN W3TC Minify core
rewrite ^/wp-content/cache/minify.*/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 last;
set $w3tc_enc "";
if ($http_accept_encoding ~ gzip) {
    set $w3tc_enc .gzip;
}
if (-f $request_filename$w3tc_enc) {
    rewrite (.*) $1$w3tc_enc break;
}
rewrite ^/wp-content/cache/minify/(.+/[X]+\.css)$ /wp-content/plugins/w3-total-cache/pub/minify.php?test_file=$1 last;
rewrite ^/wp-content/cache/minify/(.+\.(css|js))$ /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1 last;
# END W3TC Minify core