Answer the question
In order to leave comments, you need to log in
How to access apache2 sites on the local network using the .local domain?
I have a home server, let's call it bakery. Bakery has Ubuntu, and Ubuntu has Avahi, which allows you to access other bakery services, be it AFP, DLNA or CUPS, at the beautiful address bakery.local and the corresponding port. Also, bakery has apache2 installed, which, when visiting bakery.local in the browser, happily announces: It works! Now I want to access other sites in /var/www at addresses like foo.local.
I installed Passenger, deployed the Rails app to the /var/www/railsapp directory and created a config for the virtual host:
# /etc/apache2/sites-available/railsapp.conf
<VirtualHost *:80>
ServerName railsapp.local
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/railsapp/current/public
<Directory /var/www/railsapp/current/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
</VirtualHost>
sudo a2ensite railsapp; and sudo service apache2 reload
. Now when I enter the address of railsapp.local in the browser, it returns (unexpectedly) "This webpage is not available". Answer the question
In order to leave comments, you need to log in
On a home network using Avahi, it's easiest to install mod_dnssd for apache2.
After that, all virtual hosts will become available under the .local domain, which can be verified using the command avahi-browse --all
.
blog.code4hire.com/2011/03/setting-up-virtual-host...
See if you forgot something.
->logs to the studio:
a query string for your page and an error string when accessing the page.
It is necessary to register an alias to the railsapp host in the local zone. You most likely have it (local zone local), it is in the dnsmasq package. If so, then just add it to the config
Well, restart dnsmasq The config
is located in /etc/dnsmasq.d/network-manager , if NetworkManager is installed (set with x and gnome)
or /etc/dnsmasq.conf or in the files of the /etc directory /dnsmasq.d/
For advanced masochists, there is bind9, but this is a topic for a separate question.
PS. Does passenger work - look at the apache logs.
P.P.S. If you just need to get access from another host, then it is enough to register this alias in the /etc/hosts file (for Windows %SystemRoot%\system32\drivers\etc\hosts) on another host.
For example like this:192.168.0.11 railsapp bakery
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question