简体   繁体   中英

Refreshing static html cache on asp.net core 2.0

I'm busy building a website using asp.net core 2.0, and it's hosted on a Ubuntu 16.04 server with Nginx acting as a proxy. It's not a live environment but a local.

What I would like to know is, when updating static view's, eg. the about page with extra content, and upload it to the dev server, it does not update until I restart the service that the site is running under. Is there any way to get around that, so that when I upload the content, it automatically refreshes.

I've used this guide to setup Nginx and asp.net core 2.0 on the Ubuntu server :

https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction?tabs=aspnetcore2x

You should be serving static files directly from nginx instead of doing it through .NET

Assuming you have /css , /js for your assets located in your /www/inetpub/assets folder then you would add below to your nginx config

location ~* ^/(css|js)/ {
   root /www/inetpub/assets;
}

This will server css from /www/inetpub/assets/css folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM