A while ago I managed to install Virtualmin on my VPS and am currently running WordPress. I’m also using Nginx.

After restoring my blog back from the backups I made, I was able to get it up and running and started to set up the plugins.

I initially used yoast, and tried to generate a sitemat but it didn’t work – I kept getting a 404 error. I even checked using FTP and no file was found. So I looked up for solutions online and tried them all, refreshing permalinks, adding htaccess rules, adding rewrite rules to nginx.conf, purging cache and more…
But nothing worked.

I also even tried uploading a dummy sitemap_index.xml file and refreshed the sitemap setting but it was never read nor updated.

So I decided to try other plusings too, All-in-One SEO, Jetpack, Google sitemaps, but sadly none of them were also able to create a sitemap.

Please help me out I’m really stuck.

This is my .htaccess file

# WordPress SEO - XML Sitemap Rewrite Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
</IfModule>
# END WordPress SEO - XML Sitemap Rewrite Fix

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

And this is my nginx config (ikigainetwork.moe.conf)

server {
    server_name ikigainetwork.moe www.ikigainetwork.moe;
    listen 81.4.104.56;
    root /home/ikigainetwork/public_html;
    index index.html index.htm index.php;
    access_log /var/log/virtualmin/ikigainetwork.moe_access_log;
    error_log /var/log/virtualmin/ikigainetwork.moe_error_log;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME /home/ikigainetwork/public_html$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT /home/ikigainetwork/public_html;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param HTTPS $https;
    location / {
                try_files $uri $uri/ /index.php?$args; 
    }
    location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/php-nginx/14911244012458.sock/socket;
    }
location ~* .(txt|xml|js)$ {
    expires 8d;
}

location ~* .(css)$ {
    expires 8d;
}

location ~* .(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$ {
    expires 8d;
}

location ~* .(jpg|jpeg|png|gif|swf|webp)$ {
    expires 8d;
}
    listen 81.4.104.56:443 default ssl;
    ssl_certificate /home/ikigainetwork/ssl.cert;
    ssl_certificate_key /home/ikigainetwork/ssl.key;

#Yoast sitemap
location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
    rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;
        rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 last;
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

        ## following lines are options. Needed for wordpress-seo addons
        rewrite ^/news_sitemap.xml$ /index.php?sitemap=wpseo_news last;
    rewrite ^/locations.kml$ /index.php?sitemap=wpseo_local_kml last;
    rewrite ^/geo_sitemap.xml$ /index.php?sitemap=wpseo_local last;
    rewrite ^/video-sitemap.xsl$ /index.php?xsl=video last;

    access_log off;
}

}

Read more here: No wordpress plugin able to generate a sitemap


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: