Forum: NGINX cache configuration

Posted by automatix (Guest)
on 2013-01-26 20:20
(Received via mailing list)
Hello everyone!

A cache issue...

I created an XML file order.xml with this simle cotent:

<?xml version="1.0" encoding="utf-8"?>
<order ordernumber="123asdf7">
  <customer customerid="5132423">
    <name>John Doe</name>
    <address>Foo Str. 3, 10117 Berlin<address>
  </customer>
  <positions>
    <position quantity="1">
      <article articleid="71234623" name="Kindle Whitepaper" price="" />
    </position>
    <position quantity="1">
      <article articleid="12930412" name="Kindle Whitepaper" />
    </position>
    <position quantity="2">
      <article articleid="56234972" name="Kindle leather cover" />
    </position>
  </positions>
  <delivery variant="Premium" cost="0" expected="28.01.2013" />
</order>

and saved it on my VM in /var/www/sandbox/test/. As you can see, it's 
not a
valid XML (s. tag address). So the browser (XML parser) threw an error.

Then I repaired the file. But the browser is still throwing the same 
eoor.

It's defently the server(-side) cache, since I've already tried it out 
in
several browsers.

How can/should I set up the cache behavior of nginx?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235601#msg-235601
Posted by Daniel15 (Guest)
on 2013-01-27 13:11
(Received via mailing list)
It's probably browser caching - Did you try pressing Ctrl+F5 or clearing
your browser's cache?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235608#msg-235608
Posted by automatix (Guest)
on 2013-01-28 17:27
(Received via mailing list)
As I've already said: It can only be the server(-side) caching. Since
revoming of the browser cache and Ctrl+F5 don't help.

But now I think, it might be an issue of the virtual machine. Because 
when I
edit the files directly from the VM* and not in my hosst system, 
sometimes I
can see the changes in the Browser.

* The files are saved in a shared folder, so I can access to them both 
--
from the host and also from the guest system.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235661#msg-235661
Posted by kolbyjack (Guest)
on 2013-01-28 17:48
(Received via mailing list)
When using virtualbox shared folders, you need to turn off sendfile in
nginx.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235662#msg-235662
Posted by automatix (Guest)
on 2013-01-28 18:49
(Received via mailing list)
Great, it works! Thank you very much!

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235666#msg-235666
Posted by Valentin V. Bartenev (Guest)
on 2013-01-28 18:55
(Received via mailing list)
On Monday 28 January 2013 21:48:59 automatix wrote:
> Great, it works! Thank you very much!
>

That is an old well-known bug in VitualBox. See:
https://www.virtualbox.org/ticket/819https://www.virtualbox.org/ticket/9069
http://wiki.nginx.org/Pitfalls#Config_Changes_Not_Reflected

  wbr, Valentin V. Bartenev

--
http://nginx.com/support.html
http://nginx.org/en/donation.html
Posted by automatix (Guest)
on 2013-01-28 19:10
(Received via mailing list)
Didn't know it. Thank you for the info!

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235668#msg-235668
Posted by automatix (Guest)
on 2013-02-06 19:45
(Received via mailing list)
Hello!

I have to reopen this topic, because the issue is back...

I have a basic host file, that defines thr root folder for a host as:

# file ax-common-vhost
server {
    if ($host ~ ^(?<project>.+)\.(?<area>.+)\.loc$) {
        set $folder "$area/$project";
    }
    ...
    root /var/www/$folder/;
}

Now I want to add another basic vhost file for Zend Framework projects.
There the webroot should be in the older "public" directly under the 
root.
So I created a copy of my basic vhost file with a new root rule:

# ax-zf-vhost
server {
    if ($host ~ ^(?<project>.+)\.(?<area>.+)\.loc$) {
        set $folder "$area/$project";
    }
    ...
    root /var/www/$folder/public/;
}

# file zf1sandbox.sandbox.loc
include /etc/nginx/sites-available/ax-zf-vhost;

But it's not working. The server tries to open the path of the 
zf1sandbox
project root, cannot find any index file there and throws a 403 error.

I've already set the sendfile setting to "off" in all relevant
files/segments:

# file nginx.conf
http {
    ...
    sendfile off;
    ...
}

# file ax-zf-vhost
server {
    location / {
        index index.html index.php;
  sendfile off;
    }
}

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235971#msg-235971
Posted by automatix (Guest)
on 2013-02-06 19:55
(Received via mailing list)
Sorry, my mistake. It's another problem. The server is not analyzing my
zf1sandbox.sandbox.loc file, that includes the template for Zend 
Framework
vhosts (include /etc/nginx/sites-available/ax-zf-vhost;), but is using 
my
common template (ax-common-vhost).

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235601,235972#msg-235972
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.