serve static content on static domain

Valentin V. Bartenev ne at vbart.ru
Wed Apr 11 10:31:21 UTC 2012


On Wednesday 11 April 2012 11:06:21 zuckbin wrote:
> ok, can i do this ?

Sure, you can. But, please, take a look at this links:

 http://wiki.nginx.org/IfIsEvil
 http://wiki.nginx.org/Pitfalls
 http://nginx.org/en/docs/http/request_processing.html
 http://nginx.org/r/location

[...]
> 
>         server {
>         listen  ip:80;
>         server_name     static.static-yourserver.com;
>         root /srv/http/nginx/yourserver.com;
>         location / {
>                 if ($request_filename ~
> "\.(jpg|css|gif|png|swf|ico|mp3)$") {
>                         break;
>                 }
>         return 404;
>         }
>         }
> 

Then you will understand how to write good configuration:

   server {
        listen  ip:80;
        server_name     static.static-yourserver.com;
        root /srv/http/nginx/yourserver.com;

        location / {
		   return 404;        
        }

        location \.(?:jpg|css|gif|png|swf|ico|mp3)$ {

        }
   }

 wbr, Valentin V. Bartenev



More information about the nginx mailing list