本地主机上的Apache:指定虚拟主机特定的服务器名称
好的,我先问我的问题,下面是我到目前为止试图解决问题的细节: 在localhost上运行的Apache上,我希望有可以通过url访问的不同虚拟主机: 详情: 所以我在笔记本电脑的8080端口上运行Apache。Linux Mint,Debian发行版。出于测试目的,所有内容都在本地,因此不涉及DNS!我使用的IP地址是127.0.1.1,它拥有我计算机的域,称为fabjoa。在文件本地主机上的Apache:指定虚拟主机特定的服务器名称,apache,localhost,virtualhost,Apache,Localhost,Virtualhost,好的,我先问我的问题,下面是我到目前为止试图解决问题的细节: 在localhost上运行的Apache上,我希望有可以通过url访问的不同虚拟主机: 详情: 所以我在笔记本电脑的8080端口上运行Apache。Linux Mint,Debian发行版。出于测试目的,所有内容都在本地,因此不涉及DNS!我使用的IP地址是127.0.1.1,它拥有我计算机的域,称为fabjoa。在文件/etc/apache2/apache2.conf中,我将: ServerName fabjoa 在文件/etc
/etc/apache2/apache2.conf
中,我将:
ServerName fabjoa
在文件/etc/hosts
中,确实有一行
127.0.1.1 fabjoa
在文件/etc/apache2/ports.conf
NameVirtualHost *:8080
Listen 8080
现在,我的虚拟主机的conf文件。该文件名为goyahkla,位于/etc/apache2/sites available/
上,在/etc/apache2/sites enabled
中有一个符号链接。在此文件中,我有以下内容:
<VirtualHost *:8080>
ServerName goyakhla.fabjoa
ServerAdmin webmaster@localhost
DocumentRoot /var/sites/goyahkla
....
<Directory /var/sites/goyahkla/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
...
</VirtualHost>
有没有关于如何达到目的的想法
谢谢您不需要指定un hosts文件的完整主机名吗?像“goyahkla.fabjoa”而不是“fabjoa”
无论如何,这不是编程问题,应该在serverfault.com上询问这个问题
telnet goyahkla.fabjoa:8080
telnet: could not resolve goyahkla.fabjoa:8080/telnet: Name or service not known
lynx goyahkla.fabjoa:8080
Looking up 'goyahkla.fabjoa' first
Looking up 'www.goyahkla.fabjoa.com', guessing...
Looking up goyahkla.fabjoa first
Looking up www.goyahkla.fabjoa.com, guessing...
Looking up www.goyahkla.fabjoa.com:8080
Making HTTP connection to www.goyahkla.fabjoa.com:8080
Alert!: Unable to connect to remote host.
lynx: Can't access startfile http://www.goyahkla.fabjoa.com:8080/