Php 安装Apache VirtualHost(CentOs)
如何在linux上为新域名设置VirtualHost? 就是Php 安装Apache VirtualHost(CentOs),php,linux,apache,Php,Linux,Apache,如何在linux上为新域名设置VirtualHost? 就是 ->直接转到/opt/lampp/htdocs/weblog.localhost/mvc\u htdocs 我在/opt/lampp/etc/extra/httpd vhosts.conf > NameVirtualHost *:80 > > <VirtualHost *:80> > DocumentRoot "/opt/lampp/htdocs" > ServerName lo
- ->直接转到/opt/lampp/htdocs/weblog.localhost/mvc\u htdocs
> NameVirtualHost *:80
>
> <VirtualHost *:80>
> DocumentRoot "/opt/lampp/htdocs"
> ServerName localhost
> </VirtualHost>
>
> <VirtualHost *:80>
> DocumentRoot "/opt/lampp/htdocs/weblog.localhost/mvc_htdocs"
> ServerName weblog.localhost
> DirectoryIndex index.php index.html
> </VirtualHost>
>NameVirtualHost*:80
>
>
>DocumentRoot“/opt/lampp/htdocs”
>服务器名本地主机
>
>
>
>DocumentRoot“/opt/lampp/htdocs/weblog.localhost/mvc\u htdocs”
>ServerName weblog.localhost
>DirectoryIndex.php index.html
>
我在/opt/lampp/etc/httpd.conf中删除了Include etc/extra/httpd vhosts.conf的前面
> NameVirtualHost *:80
>
> <VirtualHost *:80>
> DocumentRoot "/opt/lampp/htdocs"
> ServerName localhost
> </VirtualHost>
>
> <VirtualHost *:80>
> DocumentRoot "/opt/lampp/htdocs/weblog.localhost/mvc_htdocs"
> ServerName weblog.localhost
> DirectoryIndex index.php index.html
> </VirtualHost>
但当我键入新域时,会出现一个空网站
请给我一个帮助。谢谢:)您必须在“/etc/httpd/conf.d/”中为此虚拟主机创建一个新的配置文件。创建一个新文件vhost1.conf(您可以选择任何合适的名称)。键入下面的代码
<VirtualHost *:80>
ServerName weblog.localhost
DocumentRoot /opt/lampp/htdocs/weblog.localhost/mvc_htdocs
DirectoryIndex index.php index.html
</VirtualHost>
ServerName weblog.localhost
DocumentRoot/opt/lampp/htdocs/weblog.localhost/mvc_htdocs
DirectoryIndex.php index.html
保存并退出文件。重新启动httpd服务