LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   can't access virtual host from local machine (https://www.linuxquestions.org/questions/linux-networking-3/cant-access-virtual-host-from-local-machine-412356/)

curos 02-06-2006 04:21 PM

can't access virtual host from local machine
 
Odd problem here. I've successfully setup virtual hosts on my computer and I can access them from everyone elses computer, but I can't access them from the local computer.

So sandwich.domain.edu is the default to go to. It is set as the global DocumentRoot and ServerName.
I can access it by typing its address in the browser on the local computer.

On the other hand, mentoring.domain.edu doesn't load at all and times out. On other computers, it loads fine. Any suggestions? Even better, is there a way I can trace what is happening when the request for mentoring.domain.edu is sent from my computer and how apache or whatever catches that request and interprets it?

Some more thoughts about it:
I was thinking the firewall might be a problem, since i manually did iptables myself with very basic rules, and perhaps virtual hosting gets confused that the localhost is trying to access it:
Code:

iptables -P INPUT DROP
iptables -P FORWARD DROP

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT

iptables -A INPUT -p icmp -j ACCEPT

# apache
iptables -A INPUT -p tcp --dport 80 -i eth0 -j ACCEPT


Here is also my virtual host settings. As I said, they work when accessed from any computer that is not the local computer hosting the server.

Code:

<VirtualHost *:80>
    DocumentRoot /websites/sandwich/WWW
    ServerName sandwich.domain.edu
    ErrorLog /websites/sandwich/logs/error_log
    CustomLog /websites/sandwich/logs/access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerName mentoring.domain.edu
    ServerAlias mentoring
    DocumentRoot /websites/mentoring/WWW
    ErrorLog /websites/mentoring/logs/error_log
    CustomLog /home/share/websites/svsa/mentoring/logs/access_log common
</VirtualHost>


Brian1 02-06-2006 04:44 PM

Not exactly what you are after but is based on dnat redirect of the connection. This ones talks about setting it so DNS names are seen from inside if using and internal machine to see the local dns server. Check the links from Capt Caveman there.

http://www.linuxquestions.org/questi...72#post1944372

Brian1

jschiwal 02-06-2006 05:12 PM

I believe that the behavior you are seeing is normal. You could simply enter the names and local ip address in your /etc/hosts file.

curos 02-06-2006 09:18 PM

Thanks! you're right, i just had to add it to my hosts file.


All times are GMT -5. The time now is 09:35 AM.