在apache别名中运行cakephp app [英] Run cakephp app in apache alias

查看:220
本文介绍了在apache别名中运行cakephp app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在apache 2.4服务器上部署cakephp 3.1应用程序。我的老板想把应用程序放在不同的服务器的文档目录( DocumentRoot/ var / www / html在我的httpd.conf文件),因为多个webapps由此服务器提供服务。

I'm trying to deploy a cakephp 3.1 app in a apache 2.4 powered server. My boss would like to place the app in a directory different of server's documentroot (DocumentRoot "/var/www/html" in my httpd.conf file), since multiple webapps will be served by this server.

而不是虚拟主机,他想使用别名(host / app1,host / app2等)。所以我试图这样配置。我把一个别名到我的蛋糕应用程序( Alias/ scqa/ opt / scqa / webroot在我的httpd.conf文件),并写了一个RewriteBase $ c> RewriteBase / scqa )到两个蛋糕的.htaccess文件,但是我的应用程序中存在的每个绝对链接仍指向apache的documentroot。在这种特殊情况下,这意味着我的css和一大堆没有正确建立的链接是404ing。有一些方法我可以解决它在apache配置?
我知道2其他方法来解决它:修复链接蛋糕语法(将需要我一个星期)或使用虚拟主机。但是是否可以修复它并继续使用apache别名?

Instead of virtualhosts, he would like to use aliases (host/app1, host/app2 etc). So I'm trying to configure it this way. I put an alias to my cake app (Alias "/scqa" "/opt/scqa/webroot" in my httpd.conf file) and wrote a RewriteBase (RewriteBase /scqa) to both cake's .htaccess files, but every absolute link present in my app is still pointing to apache's documentroot. In this particular case, it means my css and a big pile of not properly built links are 404ing. Is there some way I can fix it in apache configuration? I know 2 other ways to fix it: Fix the links with cake syntax (will take me a week) or use virtualhosts. But is it possible to fix it and keep using apache alias?

提前感谢。

(生产环境使用centos 7 64bits,以防万一)

(The production env uses centos 7 64bits, just in case)

推荐答案

如果我理解得很好,您在.htaccess文件中使用别名。
您应该将 Alias 放在您的服务器配置文件中,因为它不会工作。

If I understood well, you are using aliases in your .htaccess files. You should put the Alias in your server config file, because it won't work otherwise.

语法:Alias [URL-path] file-path | directory-path

Syntax: Alias [URL-path] file-path|directory-path

上下文:服务器配置,虚拟主机,目录

Context: server config, virtual host, directory

https:// httpd。 apache.org/docs/current/mod/mod_alias.html

这篇关于在apache别名中运行cakephp app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆