You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by Cequiel <gc...@email.com> on 2012/03/24 14:50:03 UTC

accessing virtual host from other computer in the same network

Hi Everyone.
I'm not sure if this is a bug. In any case, here is my problem. I have an
Ubuntu 11.10 machine and an Apache server running on it. Also, I have a
virtual host registered on my Apache server. I have no problem accessing to
my virtual host from my local machine. I just open the following url
http://mysubdomain.localhost and works perfectly.

The problem is that I want to access to my virtualhost from another computer
connected at the same router. The IP of my ubuntu machine is 192.168.1.5
(for example) and the Windows computer is 192.168.1.10 (for another
example). In the windows computer I added a new entry at the end of the
"hosts" file to override the previous url:

192.168.1.5  http://mysubdomain.localhost

So when I try to open http://mysubdomain.localhost from my Windows machine,
it tries to connect to the Ubuntu Apache server.

The problem is that when I open http://mysubdomain.localhost from my Windows
machine, the browser shows the default page, instead of the mysubdomain
page. And I don't know why this is happening.

Here's the configurations files located at /etc/apache2/sites-available:

/etc/apache2/sites-available/default:
------------------------------------------
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>


/etc/apache2/sites-available/mysubdomain.localhost:
-------------------------------------------------------------
NameVirtualHost 127.0.0.1:80
<VirtualHost mysubdomain.localhost:80>
        ServerName mysubdomain.localhost
        DocumentRoot /home/gonzalo/Projects/mysubdomain/htdocs
        ErrorLog /home/gonzalo/Projects/mysubdomain/logs/error.log
        CustomLog /home/gonzalo/Projects/mysubdomain/logs/access.log
combined
        <Directory /home/gonzalo/Projects/mysubdomain/htdocs/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
        </Directory>
</VirtualHost>


Thank you very much and sorry my English. Greetings from Spain :)
Gonzalo.
-- 
View this message in context: http://old.nabble.com/accessing-virtual-host-from-other-computer-in-the-same-network-tp33544681p33544681.html
Sent from the Apache HTTP Server - Bugs mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[users@httpd] Re: accessing virtual host from other computer in the same network

Posted by Eric Covener <co...@gmail.com>.
wrong list, use users@httpd.apache.org.

1) Apache resolves any <virtualhost> argument to an IP address at
startup and only matches the incoming interface to it
2) Apache chooses the best virtualhost, or set of identical
virtualhosts covered by a NameVirtualHost, based on the incoming
interface.
3) If NameVirtualHost was used, it then looks at ServerName and
ServerAlias in the vhosts from step 2.

On Sat, Mar 24, 2012 at 9:50 AM, Cequiel <gc...@email.com> wrote:
>
> Hi Everyone.
> I'm not sure if this is a bug. In any case, here is my problem. I have an
> Ubuntu 11.10 machine and an Apache server running on it. Also, I have a
> virtual host registered on my Apache server. I have no problem accessing to
> my virtual host from my local machine. I just open the following url
> http://mysubdomain.localhost and works perfectly.
>
> The problem is that I want to access to my virtualhost from another computer
> connected at the same router. The IP of my ubuntu machine is 192.168.1.5
> (for example) and the Windows computer is 192.168.1.10 (for another
> example). In the windows computer I added a new entry at the end of the
> "hosts" file to override the previous url:
>
> 192.168.1.5  http://mysubdomain.localhost
>
> So when I try to open http://mysubdomain.localhost from my Windows machine,
> it tries to connect to the Ubuntu Apache server.
>
> The problem is that when I open http://mysubdomain.localhost from my Windows
> machine, the browser shows the default page, instead of the mysubdomain
> page. And I don't know why this is happening.
>
> Here's the configurations files located at /etc/apache2/sites-available:
>
> /etc/apache2/sites-available/default:
> ------------------------------------------
> <VirtualHost *:80>
>        ServerAdmin webmaster@localhost
>
>        DocumentRoot /var/www
>        <Directory />
>                Options FollowSymLinks
>                AllowOverride None
>        </Directory>
>        <Directory /var/www/>
>                Options Indexes FollowSymLinks MultiViews
>                AllowOverride None
>                Order allow,deny
>                allow from all
>        </Directory>
>
>        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>        <Directory "/usr/lib/cgi-bin">
>                AllowOverride None
>                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                Order allow,deny
>                Allow from all
>        </Directory>
>
>        ErrorLog ${APACHE_LOG_DIR}/error.log
>
>        # Possible values include: debug, info, notice, warn, error, crit,
>        # alert, emerg.
>        LogLevel warn
>
>        CustomLog ${APACHE_LOG_DIR}/access.log combined
>
>    Alias /doc/ "/usr/share/doc/"
>    <Directory "/usr/share/doc/">
>        Options Indexes MultiViews FollowSymLinks
>        AllowOverride None
>        Order deny,allow
>        Deny from all
>        Allow from 127.0.0.0/255.0.0.0 ::1/128
>    </Directory>
>
> </VirtualHost>
>
>
> /etc/apache2/sites-available/mysubdomain.localhost:
> -------------------------------------------------------------
> NameVirtualHost 127.0.0.1:80
> <VirtualHost mysubdomain.localhost:80>
>        ServerName mysubdomain.localhost
>        DocumentRoot /home/gonzalo/Projects/mysubdomain/htdocs
>        ErrorLog /home/gonzalo/Projects/mysubdomain/logs/error.log
>        CustomLog /home/gonzalo/Projects/mysubdomain/logs/access.log
> combined
>        <Directory /home/gonzalo/Projects/mysubdomain/htdocs/>
>                Options Indexes FollowSymLinks MultiViews
>                AllowOverride All
>        </Directory>
> </VirtualHost>
>
>
> Thank you very much and sorry my English. Greetings from Spain :)
> Gonzalo.
> --
> View this message in context: http://old.nabble.com/accessing-virtual-host-from-other-computer-in-the-same-network-tp33544681p33544681.html
> Sent from the Apache HTTP Server - Bugs mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
> For additional commands, e-mail: bugs-help@httpd.apache.org
>



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: accessing virtual host from other computer in the same network

Posted by Jorge Román Novalbos <jr...@linux-it.es>.
Hi Gonzalo, 

Try to put this line in yours in your host file:

192.168.1.5  mysubdomain.localhost

Without http://, remember host file doesn't understand about protocol is only a file to match ip with hostname.


Also I think you have to change the NameVirtual Directive by:

NameVirtualHost *:80

When you have done all these thing and you request your site from windows machine a "403 Forbidden" could be displayed, to solve that:


> <VirtualHost mysubdomain.localhost:80>
>        ServerName mysubdomain.localhost
>        DocumentRoot /home/gonzalo/Projects/mysubdomain/htdocs
>        ErrorLog /home/gonzalo/Projects/mysubdomain/logs/error.log
>        CustomLog /home/gonzalo/Projects/mysubdomain/logs/access.log
> combined
>        <Directory /home/gonzalo/Projects/mysubdomain/htdocs/>
>                Options Indexes FollowSymLinks MultiViews
>                AllowOverride All
		  Order allow, deny
		  Allow From All
>        </Directory>
> </VirtualHost>



Bye!!




On 24/03/2012, at 14:50, Cequiel wrote:

> 
> Hi Everyone.
> I'm not sure if this is a bug. In any case, here is my problem. I have an
> Ubuntu 11.10 machine and an Apache server running on it. Also, I have a
> virtual host registered on my Apache server. I have no problem accessing to
> my virtual host from my local machine. I just open the following url
> http://mysubdomain.localhost and works perfectly.
> 
> The problem is that I want to access to my virtualhost from another computer
> connected at the same router. The IP of my ubuntu machine is 192.168.1.5
> (for example) and the Windows computer is 192.168.1.10 (for another
> example). In the windows computer I added a new entry at the end of the
> "hosts" file to override the previous url:
> 
> 192.168.1.5  http://mysubdomain.localhost
> 
> So when I try to open http://mysubdomain.localhost from my Windows machine,
> it tries to connect to the Ubuntu Apache server.
> 
> The problem is that when I open http://mysubdomain.localhost from my Windows
> machine, the browser shows the default page, instead of the mysubdomain
> page. And I don't know why this is happening.
> 
> Here's the configurations files located at /etc/apache2/sites-available:
> 
> /etc/apache2/sites-available/default:
> ------------------------------------------
> <VirtualHost *:80>
>        ServerAdmin webmaster@localhost
> 
>        DocumentRoot /var/www
>        <Directory />
>                Options FollowSymLinks
>                AllowOverride None
>        </Directory>
>        <Directory /var/www/>
>                Options Indexes FollowSymLinks MultiViews
>                AllowOverride None
>                Order allow,deny
>                allow from all
>        </Directory>
> 
>        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>        <Directory "/usr/lib/cgi-bin">
>                AllowOverride None
>                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                Order allow,deny
>                Allow from all
>        </Directory>
> 
>        ErrorLog ${APACHE_LOG_DIR}/error.log
> 
>        # Possible values include: debug, info, notice, warn, error, crit,
>        # alert, emerg.
>        LogLevel warn
> 
>        CustomLog ${APACHE_LOG_DIR}/access.log combined
> 
>    Alias /doc/ "/usr/share/doc/"
>    <Directory "/usr/share/doc/">
>        Options Indexes MultiViews FollowSymLinks
>        AllowOverride None
>        Order deny,allow
>        Deny from all
>        Allow from 127.0.0.0/255.0.0.0 ::1/128
>    </Directory>
> 
> </VirtualHost>
> 
> 
> /etc/apache2/sites-available/mysubdomain.localhost:
> -------------------------------------------------------------
> NameVirtualHost 127.0.0.1:80
> <VirtualHost mysubdomain.localhost:80>
>        ServerName mysubdomain.localhost
>        DocumentRoot /home/gonzalo/Projects/mysubdomain/htdocs
>        ErrorLog /home/gonzalo/Projects/mysubdomain/logs/error.log
>        CustomLog /home/gonzalo/Projects/mysubdomain/logs/access.log
> combined
>        <Directory /home/gonzalo/Projects/mysubdomain/htdocs/>
>                Options Indexes FollowSymLinks MultiViews
>                AllowOverride All
>        </Directory>
> </VirtualHost>
> 
> 
> Thank you very much and sorry my English. Greetings from Spain :)
> Gonzalo.
> -- 
> View this message in context: http://old.nabble.com/accessing-virtual-host-from-other-computer-in-the-same-network-tp33544681p33544681.html
> Sent from the Apache HTTP Server - Bugs mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
> For additional commands, e-mail: bugs-help@httpd.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org