Nginx Browser Caching with Alias

前端 未结 1 1609
伪装坚强ぢ
伪装坚强ぢ 2021-01-26 01:36

I\'m attempting to set up browser caching on nginx with Django. The current (working) configuration of my nginx configuration file for static files is the following:

<         


        
相关标签:
1条回答
  • 2021-01-26 02:31

    You are missing the rootdirective for the images location block. Therefore, nginx will look for the files in the default location which varies by installation and since you have most likely not placed the files there, you will get a 404 Not Found error.

    It works for the /static/location block because you defined an alias. I suspect though that the alias is simply what should be the root for both. If so, then try ...

    server {
    
        listen   443 ssl;
        server_name SERVER;
        root /path/to/web/root/folder/;
    
        [...]
    
        # Your locations ... Most likely no need for alias in any.
    }
    
    0 讨论(0)
提交回复
热议问题