# Nginx wordpress wp super cache rewrite issue

**URL:** <https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370>\
**Category:** NGINX\
**Created:** [September 22, 2010, 9:38am UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370 "2010-09-22T09:38:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 9:38am UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/1 "2010-09-22T09:38:35Z")

</div>

Hello guys, this is MAX.

I recently set up my Nginx 0.765 in CentOS 5.5 and all are working well,  
then I moved my blog there and enabled permlink and rewrite, I used to  
run WP super cache, but when I configure it, it says: mode rewrite not  
enabled. So I google it and create a file called wp-supercache.conf you  
can find it here:  
 ![](http://www.flickr.com/photos/eastmobiles/5014221980/)[wp-supercache.jpg | lu chen | Flickr](http://www.flickr.com/photos/eastmobiles/5014221980/)

I add include wp-supercache.conf; in nginx.cof:  
 ![](http://www.flickr.com/photos/eastmobiles/5013657151/)[nginxconf | lu chen | Flickr](http://www.flickr.com/photos/eastmobiles/5013657151/)

You can find location.conf here:  
 ![](http://www.flickr.com/photos/eastmobiles/5014266620/)[location.conf | lu chen | Flickr](http://www.flickr.com/photos/eastmobiles/5014266620/)

But when I test it, it says:  
 ![](http://www.flickr.com/photos/eastmobiles/5013664595/)[nginx.test | lu chen | Flickr](http://www.flickr.com/photos/eastmobiles/5013664595/)

Well line 10 is: if ($http\_cookie ~\*  
“comment\_author\_|wordpress|wp-postpass\_” )

Can anyone help? Thanks very much!!

P.S. why can’t I post image here? Please copy and past the link to view  
the images.

Posted at Nginx Forum:

> **[Nginx wordpress wp super cache rewrite issue](https://forum.nginx.org/read.php?2,132868,132868#msg-132868)**
>
> Hello guys, this is MAX. I recently set up my Nginx 0.765 in CentOS 5.5 and all are working well, then I moved my blog there and enabled permlink and rewrite, I used to run WP super cache, but when I configure it, it says: mode rewrite not enabled....

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 10:49am UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/2 "2010-09-22T10:49:25Z")

</div>

Hello,

It seems you have a typos mistakes in your supercache config file.

All “set $supercache\_uri”, you have write a double quotes, it’s two  
single quotes.  
And line 7, you have write “suercache” instead of “supercache”.

Le 22/09/2010 09:37, neomax a écrit :

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 5:48pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/3 "2010-09-22T17:48:41Z")

</div>

Hello Ben and Flavio Torres,

Thank you very much, I have made the changes to my configurations file  
and the test is successful. But when I go to wp super cache admin page  
and get all the parameters set, it just does not generate any .html  
files, it shows:

WP-Cache (0KB)

```
* 0 Cached Pages
* 0 Expired Pages

```

WP-Super-Cache (0KB)

```
* 0 Cached Pages
* 0 Expired Pages

```

I deactivate and reactive it without any lucky, I log out and delete all  
offline files and cookies, then reload the pages of my blog, and view  
the source code, but could not find any sign showing files generated by  
wp super cache, nothing.

Can you help me? I am now testing this blog, so I point my domain to my  
VPS IP in hosts file in c:\windows\system32\drivers\etc while the real  
IP is not this one.

Thanks a lot in advance.

MAX

Posted at Nginx Forum:

> **[Re: Nginx wordpress wp super cache rewrite issue](https://forum.nginx.org/read.php?2,132868,132986#msg-132986)**
>
> Hello guys, this is MAX. I recently set up my Nginx 0.765 in CentOS 5.5 and all are working well, then I moved my blog there and enabled permlink and rewrite, I used to run WP super cache, but when I configure it, it says: mode rewrite not enabled....

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/4 "2010-09-22T15:51:34Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On 09/22/2010 04:37 AM, neomax wrote:

> I recently set up my Nginx 0.765 in CentOS 5.5 and all are working well,  
> then I moved my blog there and enabled permlink and rewrite, I used to  
> run WP super cache, but when I configure it, it says: mode rewrite not  
> enabled. So I google it and create a file called wp-supercache.conf you  
> can find it here:

Hi neomax,

that’s my conf for supercache, it’s working like a charm.

```
            #
            # Regras para SuperCache
            #

            # Se o arquivo existir, retorne-o
            if (-f $request_filename) {
                    break;
            }

            set $supercache_file '';
            set $supercache_uri $request_uri;

            if ($request_method = POST) {
                    set $supercache_uri '';
            }

            # Uso de permalinks, passa o cache para qualquer string
            if ($query_string) {
                    set $supercache_uri '';
            }

            if ($http_cookie ~*

```

“comment\_author\_|wordpress|wp-postpass\_” ) {  
set $supercache\_uri ‘’;  
}

```
            # se nao passamos o cache, especifica o supercache
            if ($supercache_uri ~ ^(.+)$) {
                    set $supercache_file

```

/wp-content/cache/supercache/$http\_host/$1index.html;  
}

```
            # apenas reescreve para o supercache se o arquivo 

```

existir  
if (-f $document\_root$supercache\_file) {  
rewrite ^(.\*)$ $supercache\_file break;  
}

```
            # todas as outras requisicoes vao para o wordpress
            if (!-e $request_filename) {
                    rewrite . /index.php last;
                    rewrite ^/(.+)$ /index.php last;
            }

            # regra para blog sem supercache - usar apenas esta

```

caso nao tenha supercache  
#if (!-e $request\_filename) {  
# rewrite ^/(.+)$ /index.php last;  
#}

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.10 (GNU/Linux)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org/](http://enigmail.mozdev.org/)

iEYEARECAAYFAkyaCXgACgkQNRQApncg294OrgCdEwnSQCdcoVjtmqEahNLhO8qU  
2fcAn01Y8dGSA2CCYv0DW9XXqsbIQJrB  
=/A48  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/5 "2010-09-22T18:18:32Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On 09/22/2010 12:47 PM, neomax wrote:

> But when I go to wp super cache admin page and get all the  
> parameters set, it just does not generate any .html files, it  
> shows:

HUm… browse the source code of a random post and check if you will  
be noticed with this line of code on the VERY last line:

If so, just fix it 🙂

Also, using nginx, wordpress needs this plugin:

> **[nginx Compatibility](https://wordpress.org/plugins/nginx-compatibility/)**
>
> The plugin makes WordPress more friendly to nginx.

hope this helps  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.10 (GNU/Linux)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org/](http://enigmail.mozdev.org/)

iEYEARECAAYFAkyaK+0ACgkQNRQApncg295IfwCg7EJPRLbudoZU7HNaIdXAFWN2  
xbQAoMz1bXLoAdhi/0R8gES9AlO2/rC2  
=DOW5  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 9:23pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/6 "2010-09-22T21:23:33Z")

</div>

## neomax Wrote:

> 0/[http://www.flickr.com/photos/eastmobiles/5014221](http://www.flickr.com/photos/eastmobiles/5014221)  
> 620/
> 
> P.S. why can’t I post image here? Please copy and  
> past the link to view the images.

Just to add my take on the wp-supercache config:

[http://test.brianmercer.com/content/nginx-configuration-wordpress-wp-super-cache](http://test.brianmercer.com/content/nginx-configuration-wordpress-wp-super-cache)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,132868,133075#msg-133075](http://forum.nginx.org/read.php?2,132868,133075#msg-133075)

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 22, 2010, 8:16pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/7 "2010-09-22T20:16:13Z")

</div>

On 22.09.2010 09:37, neomax wrote:

> ![](http://www.flickr.com/photos/eastmobiles/5013657151/)[http://www.flickr.com/photos/eastmobiles/5013657151/](http://www.flickr.com/photos/eastmobiles/5013657151/)  
> Can anyone help? Thanks very much!!
> 
> P.S. why can’t I post image here? Please copy and past the link to view  
> the images.

I am not a wordpress guy but I have working (I think) wp-super-cache  
with nginx, propably in legacy mode but it’s working as I can see in the  
end of html code:

All what I did is just…

```
     try_files $uri $uri/ /index.php?q=$uri&$args;

```

Thats all. WP-super-cache warning me about missing mod\_rewrite but I  
don’t really care, its not apache.

– Piotr.

---

<div class="post-metadata">

**Author:** ![neomax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/85e7bf/32.png) [@neomax](https://www.ruby-forum.com/u/neomax)\
**Post date:** [September 23, 2010, 1:43pm UTC](https://www.ruby-forum.com/t/nginx-wordpress-wp-super-cache-rewrite-issue/195370/8 "2010-09-23T13:43:23Z")

</div>

Hi Ben and Piotr,

Thank you guys, many thanks.

I installed the Nginx compatibility plungin, and it still does not work,  
but wp super cache do not say anything like mode rewrite has not been  
installed anymore, but I still can not see any static files being  
generated.

Piotr, I tried your code and yes, the pretty url works, but when I view  
the source code when log out, I could not see anything like:

As a matter of fact, I could noe even find the letter cache.

I doubt if anything wrong with my web server or wp super cache. When I  
click on test cache, it says:

Fetching [http://cellphonetrackers.org/](http://cellphonetrackers.org/) to prime cache: OK

Fetching first copy of [http://cellphonetrackers.org/:](http://cellphonetrackers.org/:) OK

Fetching second copy of [http://cellphonetrackers.org/:](http://cellphonetrackers.org/:) OK

Page 1: 2010-09-12 06:25:16

Page 2: 2010-09-12 06:25:16

The data show above is before I moved my blog to my VPS, every time I  
test it, it shows the same date. So I uninstalled wp super cache twice  
and delete its files and folder completely, then reinstall it, still no  
luck.

I checked the /wp-content/cache folder, only to find a folder called  
meta, but no static files.

Is there anything to do with Nginx settings or wp super cache? wp super  
cache used to work well with apach without any effort.

Thanks a lot, since I have no expierince with Nginx, I am completely at  
a loss about what to do.

Posted at Nginx Forum:

> **[Re: Nginx wordpress wp super cache rewrite issue](https://forum.nginx.org/read.php?2,132868,133246#msg-133246)**
>
> Hello guys, this is MAX. I recently set up my Nginx 0.765 in CentOS 5.5 and all are working well, then I moved my blog there and enabled permlink and rewrite, I used to run WP super cache, but when I configure it, it says: mode rewrite not enabled....
