简体   繁体   English

部署CakePHP

[英]Deploying CakePHP

Locally, I have my site created in a subfolder on my server (ie: 'mysite': 'http://localhost:8888/mysite). 在本地,我在服务器的子文件夹中创建了我的站点(即:'mysite':'http:// localhost:8888 / mysite)。 When I try to deploy it, I upload the contents of mysite/ to mysite.com/ (getting rid of the sub folder). 尝试部署它时,我将mysite /的内容上载到mysite.com/(摆脱了子文件夹)。 When I access the site, the CSS files cannot be found (I'm using: echo $this->Html->css(array('style6', 'mainstyle', 'drop-menu'));). 当我访问该站点时,找不到CSS文件(我正在使用:echo $ this-> Html-> css(array('style6','mainstyle','drop-menu'));)。 If I upload the site WITH the site folder, I have to do a .htaccess redirct, and then all of my links look like: mysite.com/mysite/about. 如果使用站点文件夹上传站点,则必须进行.htaccess修改,然后所有链接都类似于:mysite.com/mysite/about。 How can I fix this? 我怎样才能解决这个问题?

You need to upload your whole app folder to the server but point the root for this site to /app/webroot/ 您需要将整个应用程序文件夹上载到服务器,但要将该站点的根目录指向/ app / webroot /

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/myapp/app/webroot"
    ServerName myapp.com
    ServerAlias myapp.com
</VirtualHost>

This would allow me to access http://myapp.com/about 这将允许我访问http://myapp.com/about

What version of Cake are you using? 您使用的是哪个版本的Cake? Look at some hardcoded configuration in core.php or elsewhere in app/config that explicitely sets mysite as sub-directory. 查看core.php或app / config中其他地方的一些硬编码配置,这些配置明确将mysite设置为子目录。 After uploading there must be some configuration value forcing Cake to behave like this, because it can not be aware of that it was running locally in that directory. 上载之后,必须有一些配置值强制Cake像这样运行,因为它无法知道它在该目录中本地运行。 Normally such setting is not needed anyway, Cake detects its relative path on the server pretty well. 通常,无论如何都不需要这种设置,Cake可以很好地在服务器上检测其相对路径。 The other thing I can think of is maybe caching: empty tmp, you might have uploaded a cached version of your views/elements. 我可以想到的另一件事可能是缓存:空的tmp,您可能已经上传了视图/元素的缓存版本。

每次部署时,我都必须更改CSS文件中图像的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM