Symfony:许多不同领域的许多项目
我正在学习Symfony。我用2个不同的域创建了2个Symfony项目。然而,我的第二个领域指向第一个领域,不知道为什么。Symfony:许多不同领域的许多项目
我下面这个教程,著名Jobeet的:http://www.symfony-project.org/jobeet/1 ...麻黄碱/ EN/01
通知我的配置:
我/etc/apache2/httpd.conf
ServerName localhost
#From the symfony tutorial "jobeet"
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080
# This is the configuration for your project
<VirtualHost 127.0.0.1:80>
ServerName www.jobeet.com.localhost
DocumentRoot "/home/lola/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/lola/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/lola/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/lola/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
#Another symfony tutorial
NameVirtualHost 127.0.0.1:8081
<VirtualHost 127.0.0.1:80>
ServerName www.tutorial.com.localhost
DocumentRoot "/home/sfprojects/tutorial/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/tutorial/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/lola/sfprojects/tutorial/lib/vendor/symfony/data/web/sf
<Directory "/home/lola/sfprojects/tutorial/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
通知我正在听端口在教程域。我尝试了VirtualHost 127.0.0.1的排列:和VirtualHost 127.0.0.1:。都没有工作。 (真不知道该用)
我的/ etc/hosts文件:
#From the symfony tutorial
127.0.0.1 www.jobeet.com.localhost
#From ANOTHER symfony tutorial
127.0.0.1 www.tutorial.com.localhost
之后,我重新启动Apache的。
现在,当我这样做: http://www.jobeet.com.localhost/frontend_dev.php/我去我Jobeet的教程东西,但当我做http://www.tutorial.com.localhost/frontend_dev.php/我ALSO去Jobeet的页面。我应该去包含教程部分的那个。
为什么不是工作??!
好:
在/etc/apache2/httpd.conf是足够用:
NameVirtualHost 127.0.0.1:80
我创造了其他ServeName(教程)时重复此命令。也许这是冲突。我全部留在港口。现在它解决了。
所以,这是最后的/etc/apache2/httpd.conf:
ServerName localhost
NameVirtualHost 127.0.0.1:80
# This is the configuration for your project
<VirtualHost 127.0.0.1:80>
ServerName www.jobeet.com.localhost
DocumentRoot "/home/lola/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/lola/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/lola/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/lola/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
#Another symfony tutorial
# DO NOT REPEAT NameVirtualHost 127.0.0.1:80 --------> ****HERE: do not repeat this****
<VirtualHost 127.0.0.1:80>
ServerName www.tutorial.com.localhost
DocumentRoot "/home/sfprojects/tutorial/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/tutorial/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/lola/sfprojects/tutorial/lib/vendor/symfony/data/web/sf
<Directory "/home/lola/sfprojects/tutorial/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
的/ etc/hosts文件(或在/ etc/apache2的/网站,缴费用于Debian)是一样的。
我可以访问www.jobeet.com.localhost和www.tutorial.com.localhost
对不起,这是我的错误配置。
一个常见的错误是已经禁用了虚拟主机模块为Apache,用于启用尝试:
sudo a2enmod virtualhost
把你的虚拟主机的conf在
/etc/apache2/sites-available/name-file-with-vhost-conf
所有虚拟主机必须启用,与
sudo a2ensite name-file-with-vhost-conf
apache2必须重新加载
sudo service apache2 reload
你可以试试这个github/rokemaster/virtual_hosts是一个脚本
它听起来更像是一个网络服务器(Apache)的问题,所有的步骤.... – 2012-02-01 19:14:17
这是我的错误。我会在8小时后发布 - 因为我的声誉在100以内 - 所以,对于明天,我会提出答案。简短的一个:NameVirtualHost必须被调用一次,如NameVirtualHost:80 – Kani 2012-02-01 20:52:57
我可以建议,如果您是第一次学习Symfony,那么您应该学习Symfony2。从现在开始,Symfony 1将不再支持。 – lonesomeday 2012-02-02 13:30:07