3

I am trying to serve a website with nginx. I have noticed that when I make changes to my /etc/nginx/sites-available/game, run sudo service nginx restart, it is not reflected when I try to pull it up in the browser.

The browser just hangs and waits for a response and then timesout.

However, it works perfectly fine if I try to do a curl request to my site on the command line. I get the normal nginx html basic file. Why is that? Here. (and yes, I have made a soft link from sites-enabled/game to sites-available/game)

server {
  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;

  root /usr/share/nginx/html;
  index index.html index.htm;

  server_name my.site.uw.edu;

  location / {
    try_files $uri $uri/ =404;
  }

}

Also, I am using Ubuntu 14.04. I don't think this version of Linux uses SELinux, but could this be some sort of security configuration related deal? I have had trouble in the past with SELinux when deploying on CentOS machines.

Jeremy
  • 1,313
  • 3
  • 20
  • 42
  • 1
    Possibly a caching issue? Did you try to reload the page, [bypassing the cache](https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache)? – tarleb Aug 18 '15 at 15:43
  • wow, yeah I cleared the cache and it worked. So once other people start viewing the site, how do I make changes to my nginx server and still have it reflected on the client end? Honestly I don't anticipate changing the nginx configuration ever, but just in case the situation arises – Jeremy Aug 18 '15 at 15:46
  • [Making sure a web page is not cached](http://stackoverflow.com/q/49547/2425163) (doesn't handle nginx, but should not be too different). – tarleb Aug 18 '15 at 15:52

1 Answers1

4

You can disable adding or modifying of “Expires” and “Cache-Control” response header using expires param:

expires off;

nginx docs

Valery Viktorovsky
  • 5,832
  • 3
  • 32
  • 42
  • actually I am still getting the same issue when i try to redirect 80 to 443 – Jeremy Aug 18 '15 at 16:09
  • 1
    Could you show full nginx config with redirect rules? Try to use snippet bellow for redirect: server { server_name yourdomain.com; return 301 https://$server_name$request_uri; } – Valery Viktorovsky Aug 18 '15 at 16:42
  • 1
    yeah I had that. I finally found it was an iptables issues. The server had some some strict configuration that I was not aware of. Good thinking though – Jeremy Aug 18 '15 at 17:04