【问题标题】:Yeoman angular dist version of app, does not restrict the direct folder accessYeoman angular dist 版本的应用程序,不限制直接文件夹访问
【发布时间】:2015-06-03 07:08:43
【问题描述】:

我的 Angular 应用程序面临这个问题。

Dist 版本的应用,不限制直接文件夹访问。

因此可以访问 www.mysite.com/scripts 和 /images 和 /styles 文件夹。

此问题未在开发中,即 grunt serve 这是在 grunt serve:dist.

我已经尝试使用 dist 文件夹的 .htaccess 来拒绝文件夹。但无济于事

【问题讨论】:

    标签: angularjs .htaccess gruntjs yeoman-generator yeoman-generator-angular


    【解决方案1】:

    .htaccess 文件是特定于 apache 服务器的,但您正在运行 grunt,因此所有 .htaccess 文件都将被忽略。

    您不应该将 Grunt 用作您的生产服务器,因为它仅设计用于本地开发环境。

    看这里: can grunt server use for production application deployment

    使用 grunt 生成的文件(在 dist 文件夹中)可以毫无问题地复制到任何其他服务器,旨在为生产中的文件提供服务(nginx 或 apache)。

    【讨论】:

    • 是的,谢谢指导,生产服务器我会用express。
    猜你喜欢
    • 1970-01-01
    • 2016-09-03
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 2021-02-08
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多