【发布时间】:2016-11-06 11:40:39
【问题描述】:
我正在使用 apache 2.2.15,在 CentOS 6 上的虚拟机中,我有一个 symfony 项目在这里工作,我的老板想在子域的同一服务器上加载一个 wordpress 网站。 子域不工作,我尝试了很多配置,这是最后一个使用的:
mysite.cl.conf(在 /etc/httpd/conf.d 文件夹中)
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/symfonyProyect/web
ServerName mysite.cl
ServerAlias mysite.cl
ErrorLog /var/log/httpd/symfonyProyect_error.log
CustomLog /var/log/httpd/symfonyProyect_access.log combined
<Location />
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /app.php [L]
</IfModule>
DirectoryIndex app.php
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName mysubdomain.mysite.cl
DocumentRoot /var/www/html/mysubdomain
<Directory /var/www/html/mysubdomain>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/mysubdomain_error.log
CustomLog /var/log/httpd/mysubdomain_access.log combined
</VirtualHost>
我的主机文件(在 /etc 文件夹中)
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
myip mysite.cl mysubdomain.mysite.cl
还有我的 hosts.conf
multi on
当我尝试 mysite.cl 时,它会显示 symfony 网站,但是当我尝试 mysubdomain.mysite.cl 时,它会给我“This site can't be reached”或“ERR_NAME_NOT_RESOLVED”。
如果我删除第一个 VirtualHost 块,它会显示 wordpress 网站(即使使用ServerName mysubdomain.mysite.cl)。
我错过了一些配置还是什么?
【问题讨论】:
标签: symfony subdomain virtualhost centos6 apache2.2