Drupal + Lighttpd:启用干净的 url(重写)

发布于 2024-10-09 03:09:53 字数 983 浏览 0 评论 0原文

我在我的 Mac 上模拟 Ubuntu,并将其用作服务器。

我已经安装了lighttpd + Drupal,并且以下配置部分需要域名才能使干净的网址正常工作。

由于我使用的是本地服务器,所以我没有域名,并且考虑到本地计算机的 IP 通常会发生变化,我想知道如何使其工作。

谢谢

$HTTP["host"] =~ "(^|\.)mywebsite\.com" {
  server.document-root = "/var/www/sites/mywebsite"
  server.errorlog = "/var/log/lighttpd/mywebsite/error.log"
  server.name = "mywebsite.com"
  accesslog.filename = "/var/log/lighttpd/mywebsite/access.log"
  include_shell "./drupal-lua-conf.sh mywebsite.com"

  url.access-deny += ( "~", ".inc", ".engine", ".install", ".info",
       ".module", ".sh", "sql", ".theme",
       ".tpl.php", ".xtmpl", "Entries",
       "Repository", "Root" )


  # "Fix" for Drupal SA-2006-006, requires lighttpd 1.4.13 or above
  # Only serve .php files of the drupal base directory
  $HTTP["url"] =~ "^/.*/.*\.php$" {
      fastcgi.server = ()
      url.access-deny = ("")
  }

  magnet.attract-physical-path-to = ("/etc/lighttpd/drupal-lua-scripts/p-.lua")

}

I'm emulating Ubuntu on my mac, and I use it as a server.

I've installed lighttpd + Drupal and the following configuration section requires a domain name in order to make clean urls to work.

Since I'm using a local server I don't have a domain name and I was wondering how to make it work given the fact the ip of the local machine is usually changing.

thanks

$HTTP["host"] =~ "(^|\.)mywebsite\.com" {
  server.document-root = "/var/www/sites/mywebsite"
  server.errorlog = "/var/log/lighttpd/mywebsite/error.log"
  server.name = "mywebsite.com"
  accesslog.filename = "/var/log/lighttpd/mywebsite/access.log"
  include_shell "./drupal-lua-conf.sh mywebsite.com"

  url.access-deny += ( "~", ".inc", ".engine", ".install", ".info",
       ".module", ".sh", "sql", ".theme",
       ".tpl.php", ".xtmpl", "Entries",
       "Repository", "Root" )


  # "Fix" for Drupal SA-2006-006, requires lighttpd 1.4.13 or above
  # Only serve .php files of the drupal base directory
  $HTTP["url"] =~ "^/.*/.*\.php$" {
      fastcgi.server = ()
      url.access-deny = ("")
  }

  magnet.attract-physical-path-to = ("/etc/lighttpd/drupal-lua-scripts/p-.lua")

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2024-10-16 03:09:53

您始终可以使用 localhost 作为主机名。 localhost 指向 127.0.0.1,这是您的本地服务器。假设 lighttpd 配置为侦听每个应该工作的接口。

只需尝试 http://localhost/ 看看会发生什么。

如果您需要在 Web 根目录的子目录中配置站点,例如 http://localhost/site1/如果您想从像 site1.localhost 这样的单个域访问它,您可以随时将其添加到主机文件 (/etc/hosts) 中:

127.0.0.1        site1.localhost

并适当配置lighttpd。

You can always use localhost as the hostname. localhost points to 127.0.0.1 which is your local server. Assuming lighttpd is configured to listen on every interface that should work.

Just try http://localhost/ and see what happens.

if you need to configure your site in a subdirectory of your web root dir, something like http://localhost/site1/ and you want to access that from a single domain like site1.localhost you can always add that to the hosts file (/etc/hosts):

127.0.0.1        site1.localhost

And configure lighttpd appropriately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文