关于nginx 重写路径问题

server

    {

        listen 80;

        server_name  www.asb.com;

        listen 443 ssl;

        access_log off;

        access_log /dev/null;

        error_log /dev/null;

      #  index neindex.html index.html index.html;

      # root /home/www/weihu.abc.com/;

      #  root /sas/tomcat_server/www17042/adad.adads.com/official/;

        #error_page 404 /index.html;


      location  / {

            rewrite ^(.*)$ /neindex.html break;

            index  neindex.html index.htm;

            root /sas/tomcat_server/www17042/adadad.com/official/;

        }

      location ~*  \.png$ {

      # rewrite /img/bodyBg.png break;

        alias  /sas/tomcat_server/www17042/adadada.com/official/img/bodyBg.png;

}


}

初学 后续添加解释

official/index.html 无论域名添加什么后缀 都是重写到neindex.html

然后就是无论是什么图片 只要是png结尾直接找alias  路径给的路径

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容