cakephp - 一个框架,本地主机子域上的一些应用程序

发布于 2024-11-04 21:55:06 字数 313 浏览 5 评论 0原文

如何准备 CakePHP 框架以在一个 CakePHP 框架中为多个应用程序工作? 我想准备这样的结构文件夹:

  1. app1/
  2. app2/
  3. app3/
  4. cake/
  5. vendors/
  6. plugins/
  7. index.php

我想使用 http:// /app1.localhost/ 是否从 app1/ 文件夹运行应用程序? 有可能吗?

How to prepare CakePHP framework to work for many apps in one CakePHP framework?
I want prepare structure folders like this:

  1. app1/
  2. app2/
  3. app3/
  4. cake/
  5. vendors/
  6. plugins/
  7. index.php

I would like using http://app1.localhost/ do running app from app1/ folder?
It's possible?

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

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

发布评论

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

评论(2

禾厶谷欠 2024-11-11 21:55:06

基本上,您需要做的就是正确配置每个应用程序的 app/webroot/index.php 文件以指向正确的 ROOT/cake 文件夹。剩下的就是 Apache 虚拟主机配置,将子域指向正确的应用程序文件夹。

Basically all you need to do is configure the app/webroot/index.php file of every individual app correctly to point to the correct ROOT/cake folder. The rest is Apache virtual host configuration to point the subdomains to the right app folder.

む无字情书 2024-11-11 21:55:06

我正在运行 XAMPP,但我假设您正在计算机上运行类似的东西。不管怎样,进入您的 apache\conf 文件夹并打开 httpd.conf 文件。 XAMPP 有一个名为 apache\conf\extra\httpd-vhosts.conf 的文件,它更适合添加虚拟主机。

因此,您需要输入适当的指令,如下所示...

<VirtualHost *:80>
    ServerAdmin postmaster@localhost
    DocumentRoot "C:/path-to-your-app-webroot-folder-no-trailing-slash"
    ServerName app.localhost
    ##ServerAlias www.dummy-host.localhost
    ErrorLog "logs/app.localhost-error.log"
    CustomLog "logs/app.localhost-access.log" combined
    <Directory "C:/path-to-your-app-webroot-folder-no-trailing-slash">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all  
    </Directory>
</VirtualHost>

此外,如果您使用的是 Windows XP,您需要在 C:\Windows\system32\drivers\etc\hosts 中输入一个条目127.0.0.1 app.localhost 文件来解析子域。那应该可以完成工作。

I'm running XAMPP but I'm assuming you're running something similar on your machine. Anyway, go into your apache\conf folder and open up the httpd.conf file. XAMPP has a file called apache\conf\extra\httpd-vhosts.conf that is better for adding Virtual Hosts.

So you'd want to enter the appropriate directives like so...

<VirtualHost *:80>
    ServerAdmin postmaster@localhost
    DocumentRoot "C:/path-to-your-app-webroot-folder-no-trailing-slash"
    ServerName app.localhost
    ##ServerAlias www.dummy-host.localhost
    ErrorLog "logs/app.localhost-error.log"
    CustomLog "logs/app.localhost-access.log" combined
    <Directory "C:/path-to-your-app-webroot-folder-no-trailing-slash">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all  
    </Directory>
</VirtualHost>

Furthermore, if you're on Windows XP, you'll want to make an entry in your C:\Windows\system32\drivers\etc\hosts file of 127.0.0.1 app.localhost to resolve the sub-domain. That should get the job done.

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