HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   HowTo access installed site via hostname not IP (http://www.howtoforge.com/forums/showthread.php?t=61569)

dimko 22nd April 2013 16:44

HowTo access installed site via hostname not IP
 
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
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
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
<VirtualHost *:80>
ServerName buro
ServerAlias buro

DocumentRoot /var/www
ErrorLog /var/www/error.log
CustomLog /var/www/access.log common

</VirtualHost>


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.

bch 22nd April 2013 21:27

Hello dimko

I would add this line to the LAN PC's hosts file,
(assuming it's Windows PC's - C:\WINDOWS\system32\drivers\etc\hosts):

192.168.190.17 buro

Then the LAN PCs know where to look for buro.

You could also change their primary DNS to 192.168.190.17,
but then your server will be asked for all domains requested from LAN PC's
which would be rejected, and then the LAN PC's will try with their secondary DNS.

If you have a domain with DNS (or too many LAN PC's to edit) you could also point
buro.yourdomain.com to 192.168.190.17 from your domain provider's DNS control panel.

Some gateways/routers also have the ability to resolve local domains.

This is only about resolving. It's not about configuring the server alias.


All times are GMT +2. The time now is 22:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.