Results 1 to 7 of 7

Thread: Access site from network by hostname

  1. #1
    Join Date
    Jun 2011
    Beans
    2

    Question Access site from network by hostname

    Hi

    I use Ubuntu 12.10.
    I read a lot of information and as result I have become more confused.
    I have installed Apache, MySQL, PHP and phpMyAdmin successfully. And I can access my site from local network by 192.168.190.17.
    How can I do access via alias as "buro" or smth like it from LAN.

    Should I configured bind9 or just correct cinfigure Virtual Hosts?

    I tried to edit /etc/hosts, added virtual host
    /etc/hostname
    Code:
    websrv
    
    /etc/hosts           
    127.0.0.1       localhost buro
    #192.168.190.17  buro
    192.168.190.17  websrv
    #192.168.180.17 websrv
    /etc/nsswitch.conf
    Code:
    passwd:         compat
    group:          compat
    shadow:         compat
    
    hosts:          files dns
    networks:       files
    
    protocols:      db files
    services:       db files
    ethers:         db files
    rpc:            db files
    
    netgroup:       nis
    /etc/apache2/sites-available/default
    Code:
    <VirtualHost *:80>
            ServerName buro
            ServerAlias buro
    
            DocumentRoot /var/www
            ErrorLog /var/www/error.log
            CustomLog /var/www/access.log common
    
    </VirtualHost>
    Code:
    root@websrv:~# sudo /etc/init.d/apache2 restart
     * Restarting web server apache2
    apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.190.17 for ServerName
     ... waiting apache2: Could not reliably determine the server's fully qualified domain name,
    using 192.168.190.17 for ServerName
       ...done.     
    
    root@websrv:/etc/apache2/sites-available# sudo a2ensite buro
    ERROR: Site buro does not exist!      
    
    root@websrv:/etc/apache2/sites-available# ping buro
    PING localhost (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.038 ms
    From another PC cannot ping by hostname.

    /etc/apache2/apache2.conf - This config I left without any change.
    Last edited by sandyd; April 22nd, 2013 at 05:47 PM. Reason: code tags

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Access site from network by hostname

    The simplest way is to add buro to /etc/host on the PC you want to access it from
    Code:
    192.168.190.17  buro

  3. #3
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: Access site from network by hostname

    Between Ubuntu machines, you can use "<hostname>.local.".

    For example:

    Code:
    sander@hapee:~$ ping flappie.local.
    PING flappie.local. (192.168.0.101) 56(84) bytes of data.
    64 bytes from flappie.local (192.168.0.101): icmp_req=1 ttl=64 time=7.59 ms
    64 bytes from flappie.local (192.168.0.101): icmp_req=2 ttl=64 time=3.15 ms
    HTH

  4. #4
    Join Date
    Jun 2011
    Beans
    2

    Re: Access site from network by hostname

    as you see in host I have already added. I commended it as it didn't resolve issue

    #192.168.190.17 buro

  5. #5
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Access site from network by hostname

    Sorry, I misunderstood what you did. I thought you added it to /etc/hosts on the machine you want to access to, i.e. on buro itself which is obviously wrong.

  6. #6
    Join Date
    Jan 2011
    Beans
    193

    Re: Access site from network by hostname

    Does your firewall allow connections from outside world? I mean, ping is not enough. must have allowed port 80.
    Last edited by kuifje09; April 22nd, 2013 at 09:04 PM.

  7. #7
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Access site from network by hostname

    Entries that begin with a "hash" mark ("#") are comments and thus ignored by nearly all programs in the Linux world. The entry
    Code:
    #192.168.190.17 buro
    is no different from having no entry at all. Remove the hash mark.

    Also you might be able to tell your router to advertise buro as a hostname via DNS. Browse around your router settings and see if that's possible. Better yet, give the machine a static IP address so it will always have the same hostname-to-IP mapping.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •