duanfei8897
2018-04-28 09:51
浏览 69
已采纳

没有Nginx或Apache的Golang htaccess配置

I've created web app and analyzed it with Google site analyzer.

In most cases I need to configure htaccess file. As I understand this file can be used only on Nginx or Apache server, but I don't want to use any of these.

I want to configure htaccess only with golang tools. Currently my app running on VPS server.

图片转代码服务由CSDN问答提供 功能建议

我创建了网络应用,并使用 Google网站分析器进行了分析。

在大多数情况下,我需要配置 htaccess 文件。 据我了解,此文件只能在Nginx或Apache服务器上使用,但我不想使用其中任何一个。

我只想使用golang工具配置htaccess。 目前,我的应用程序正在VPS服务器上运行。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongyangben6144 2018-04-28 10:00
    已采纳

    You don't need .htaccess as it's only meant for Apache:

    http://httpd.apache.org/docs/2.2/howto/htaccess.html

    If you use Apache, external services like Google Site Analyzer can't see .htaccess since it's not served by Apache. It's kept private.

    Everything Apache can do with .htaccess, Go can do with net/http or with a 3rd package like Gorilla to help.

    打赏 评论
  • dst8922 2019-05-20 10:02

    This project allows you to support the http auth standard with GO, zero apache code.

    You can even use a password file created with the Apache htpasswd (bad) or htdigest (good) commands:

    https://github.com/abbot/go-http-auth

    打赏 评论

相关推荐 更多相似问题