2013-03-25 108 views
1

我是Symfony的初学者,并且遇到麻烦使它可以正常工作。我在我的机器上运行apache 2(ubuntu)。看来,我可以通过URL到达配置: 本地主机/ Symfony的/ WEB/config.php文件Symfony总是会出现404错误

另外,我可以通过这个网址到达主页: 本地主机/ Symfony的/ WEB/app_dev.php (我看到的第一条消息是:加载Web调试工具栏时发生错误(404:未找到)。是否打开分析器?)。我唯一能做的就是取消(如果你尝试接受,我找不到404)。

之后,没有任何工作。即便是 。总是找不到404。

正如我所发现的,它可能是缓存或可能与apache配置有关的问题。但无论我尝试它都不能解决问题(其他人在这里请求类似于stackoverflow,但没有解决我的问题)。

有人知道吗?提前致谢。

+1

有你给777权限缓存和日志 – 2013-03-25 09:37:36

+0

suthar你只是省略了你好字符:) – 2013-03-25 09:39:18

回答

4

我曾经有过这样的问题太多,请看看我的配置,并尝试出来

在我的.htaccess中:

大家好,我也一直有这个问题。而且似乎“股票”.htaccess是问题。我已经在我的环境解决这一点,这里是我的.htaccess与笔记:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 
    RewriteRule ^(.*) - [E=BASE:%1] 
    RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
    RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially 
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteRule .? - [L] 
    RewriteRule .? %{ENV:BASE}/app_dev.php [L]  ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially 
</IfModule> 

<IfModule !mod_rewrite.c> 
    <IfModule mod_alias.c> 
     # When mod_rewrite is not available, we instruct a temporary redirect of 
     # the startpage to the front controller explicitly so that the website 
     # and the generated links can still be used. 
     RedirectMatch 302 ^/$ /app.php/ 
     # RedirectTemp cannot be used instead 
    </IfModule> 

在/ etc/apache2的/我 “的symfony” 条目中站点可用:

<VirtualHost 127.0.1.15> 
    ServerAdmin [email protected] 
    ServerName symfony 
    DocumentRoot /var/www/Symfony/web 
DirectoryIndex app.php 
    <Directory /var/www/Symfony/web> 
     Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all 
</Directory> 

ErrorLog ${APACHE_LOG_DIR}/error.log 
# Possible values include: debug, info, notice, warn, error, crit, 
# alert, emerg. 
LogLevel warn 
CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 
+3

对于未来的读者,我有这个问题,我错过了Apache的配置中的“AllowOverride All”。 – Halfstop 2015-06-22 16:30:48