You are not logged in.
I have an apache server running on my local network server and I can access it from another computer in a browser using the server's ip. I also, however, want to be able to access it by it's hostname: noa
I assumed this required a vhosts setup so I uncommented the required Include line in httpd.conf and edited httpd-vhosts.conf to the following:
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost noa:80
<VirtualHost noa:80>
ServerAdmin phunnilemur@gmail.com
DocumentRoot "/srv/http"
ServerName noa
ErrorLog "/var/log/httpd/error_log"
CustomLog "/var/log/httpd/access_log" common
</VirtualHost>
For some reason I get an "Access Denied" error. As I say, it works perfectly well if I use the ip to access the server rather than the hostname.
Offline
The machine you're browsing from will need to be able to resolve the name "noa" to the ip of your webserver somehow.
So you'll either need to run a dns server in your network (overkill if it's just for this one host), or simply add an entry to the client machine's hosts file for example.
Burninate!
Offline
It already can. I can ping the server using the name "noa" - and I can access the glassfish server running on the server using the name "noa". Just not my apache server...
Offline
I think you must add an entry to your /etc/hosts file, as follows:
127.0.0.1 noa noa
and create a vhost entry on /etc/httpd/conf/extra/httpd-vhosts
<VirtualHost *:80>
ServerName noa
DocumentRoot "/srv/http/"
<Directory "/src/http/">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Although I'm not sure if the vhost is actually necesary, but it won't harm.
pd: if you use vhosts, remember to uncomment "Include conf/extra/httpd-vhosts.conf" con /etc/httpd/conf/httpd.conf and restart apache
# systemctl restart httpd
Offline
Thanks for the reply - tried it, but it didn't work. Still same error: "Access Denied.", while going via the ip works.
Offline