Mobile app version of vmapp.org
Login or Join
Sarah324

: Www.foobar.com works but foobar.com results in a 'Server not found' error I have just setup a minimal (hopefully secure? - comments welcome) apache website using the following configuration file:

@Sarah324

Posted in: #Apache #Configuration #HttpdConf #Security

I have just setup a minimal (hopefully secure? - comments welcome) apache website using the following configuration file:

<VirtualHost *:80>
ServerName foobar.com
ServerAlias foobar.com ServerAdmin webmaster@foobar.com
DocumentRoot /path/to/websites/foobar/web
DirectoryIndex index.php

# CustomLog with format nickname
LogFormat "%h %l %u %t "%r" %>s %b" common
CustomLog "|/usr/bin/cronolog /var/log/apache2/%Y%m.foobar.access.log" common

LogLevel notice
ErrorLog "|/usr/bin/cronolog /var/log/apache2/%Y%m.foobar.errors.log"

<Directory />
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>

<Directory /path/to/websites/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>


I am able to access the website by using foobar.com, however when I type foobar.com, I get the error 'Server not found' - why is this?

My second question concerns the security implications of the directive:

<Directory /path/to/websites/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>


in the configuration above. What exactly is it doing, and is it necessary?. From my (admitedly limited) understanding of Apache configuration files, this means that anyone will be able to access (write to?) the /path/to/websites/ folder. Is my understanding correct? - and if yes, how is this not a security risk?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sarah324

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi8258870

In order to work with two names under one site you have


Respond from Apache side on both Host request (you done it)
Configure DNS for domain in order to

have 2 URLs
route to the correct host



In short: nslookup foobar.com and nslookup foobar.com must return answers and answers to be identical

Your impression about <Directory> container directive is wrong. Any host can reach this URL and get content. Zero suppositions and judgments about the possibility of writing. Maybe you start reading Apache docs before asking questions?!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme