如何在Rails公共目录的子目录中使用CSS设置静态页面

我正在尝试在我的public / blog目录中设置jekyll博客。

对于这个问题,可以说我只想为该页面的public/blogindex.html的css创建一个目录。

我正在使用capistrano进行部署,因此我将css/site.css添加到了public/blog

index.html:

linked_dirs

css / site.css:

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="css/site.css">
  </head>
  <body>
    <h1>Hello World</h1>
  </body>
</html>

现在h1 { color: red; } 之后,我可以访问cap production deploy并看到domain.com/blog标头,但它不会加载CSS文件。

我收到Hello World错误。

你知道我该怎么做吗?

j445566321 回答:如何在Rails公共目录的子目录中使用CSS设置静态页面

更多是一个nginx问题。

我将此添加到我的站点nginx文件中:

  location ^~ /blog/css/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }
本文链接:https://www.f2er.com/2920532.html

大家都在问