简体   繁体   English

在/ web目录Symfony2项目中禁止访问

[英]Access forbidden in /web directory Symfony2 project

I'm working on a Symfony2 project at local server without any virtual hosting or something else. 我正在本地服务器上的Symfony2项目上工作,而没有任何虚拟主机或其他东西。 After I run the command php app/console assets:install --symlink , clear the cache and refresh the page none styles or javascript or images are loaded. 运行命令php app/console assets:install --symlink ,清除缓存并刷新页面,不加载任何样式或javascript或图像。 Inspecting the source code and trying to access any of those assets I get this error: 检查源代码并尝试访问这些资产中的任何一个,我得到此错误:

You don't have permission to access /cmplatform/web/bundles/clanmovilcommon/css/bootstrap.min.css on this server. 您无权访问此服务器上的/cmplatform/web/bundles/clanmovilcommon/css/bootstrap.min.css。

What I need to change in my /etc/httpd/conf/httpd.conf to fix that problem? 我需要在/etc/httpd/conf/httpd.conf进行哪些更改以解决该问题? It's related to .htaccess problem or what? 它与.htaccess问题有关?

This error is due to the user that you are currently logged in as not having correct to write to the /cmplatform/web directory. 此错误是由于您当前登录的用户不正确地写入/ cmplatform / web目录而导致的。 Or you have not got the root path set correctly in your apache.conf. 或者您没有在apache.conf中正确设置根路径。

Can you confirm other pages / assets are being served correctly. 您能确认其他网页/资产是否正确投放吗?

Take a look at who owns the directory and either adjust the write permissions or add your user / web server to own the directory or into the group. 查看谁拥有目录,并调整写许可权,或将您的用户/ Web服务器添加到目录或组中。

This is quite a common issue - and care needs to be taken to ensure that write permissions for web, cache and log directories are set correctly to allow command line and web server (eg apache / nginx) users. 这是一个非常普遍的问题-需要注意确保正确设置Web,缓存和日志目录的写入权限,以允许命令行和Web服务器(例如apache / nginx)用户。

See http://symfony.com/doc/current/book/installation.html - permissions for some tips about fixing this. 有关解决此问题的一些提示,请参见http://symfony.com/doc/current/book/installation.html-权限。

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

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