运行Ghost时允许访问子文件夹

时间:2014-04-10 21:38:00

标签: node.js nginx express ghost-blog

我希望创建一个独立页面文件夹,用作我的Ghost博客中引用的演示。例如,如果我正在撰写关于开发的教程,我想链接到成品的完整演示。

因此,如果我的Ghost博客位于http://blog.mysite.com,我希望能够访问http://blog.mysite.com/demos

中的任何独立文件

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

要实现此目的,您必须告诉您的网络服务器将来自/demos/的传入流量指向Ghost以外的其他位置。你没有说你正在运行你的网站的网络服务器,所以我给你两个例子。

假设您的演示文件位于以下目录/var/www/demos

Apache,将网址映射到位置
Alias指令允许将文档存储在除DocumentRoot之外的本地文件系统中。

Alias  /demos/  /var/www/demos
<Directory /var/www/demos>
    Options All
    AllowOverride All
    order allow,deny
    allow from all
</Directory>

Apache documentation

NGINX,将网址映射到位置
别名定义了指定位置的替换。

location /demos/ {
    alias /var/www/demos/;
}

NGINX documentation

答案 1 :(得分:1)

我只需添加一个位置块即可将其从全部

中排除
location /demos/ {
  try_files $uri =404;
}