springboot nginx动静分离


springboot nginx动静分离

                    

应用:静态资源从nginx获取,动态资源从后端获取,减轻后端服务压力

                            

                           

********************

示例

                    

*************

config 层

             

WebConfig

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/index").setViewName("index");
    }
}

你可能感兴趣的:(springboot,nginx)