开发者

Apache on localhost: give virtual hosts specific servers name [closed]

开发者 https://www.devze.com 2023-01-19 04:46 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

Ok, I ask my question first and below are details of what I have so far trying to solve the thing:

On Apache running on localhost, I want to have different virtual hosts that would be accessible through url: http://name-of-the-virtual-host.name-of-the-machine/

Details:

So I have Apache running on port 8080 of my laptop. Linux Mint, so Debian distro. Everything is in local for testing purposes, so no DNS involved! The IP address I use is 127.0.1.1 which has the domain of my computer, called fabjoa. On the file /etc/apache2/apache2.conf, I've put:

ServerName fabjoa

In the file /etc/hosts, there is indeed the line

127.0.1.1   fabjoa

In the file /etc/apache2/ports.conf

NameVirtualHost *:8080
Listen 8080

Now, the conf file of my virtual host. The file is called is goyahkla and is located on /etc/apache2/sites-available/ and has a symbolic link in /etc/apache2/sites-enabled. On this file, I have the following:

<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>

Running apache2ctl configtest gives me Syntax OK. Now, on browser, opening http://fabjoa:8080/ does point to the Virtual Host goyahkla (beacause that's the only one I have), but http://goyahkla.fabjoa:8080 is not found. Other debugging:

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.开发者_Go百科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/ 

Any idea on how purpose could be achieved?

Thank you


Don't you need to specify full hostname un hosts file? Like "goyahkla.fabjoa" instead of "fabjoa"?

Anyway, this is not programming question and should be asked on serverfault.com

0

精彩评论

暂无评论...
验证码 换一张
取 消