How come Apache retrieves files from the `html` subdirectory when only `/var/www` is specified in `<Directory>` path - apache

I have the following (default) <Directory> directive in my apache2.conf configuration file:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and the /var/www directory contains only an html directory with an index.html file inside and no .htaccess (neither near or in the html directory). What default configuration value makes Apache give me files fro the html directory? I would have expected that the DocumentRoot (if nowhere provided) is the Directory path.

I am not sure which OS and distro you are using, but my Mint/Ubuntu has /etc/apache2/sites-available/000-default.conf which DocumentRoot is /var/www/html
Please check if you have the same VirtualHost

Related

Directory 'static' gives 404 error

On a Windows machine running XAMPP I have a folder in my web root called 'static'. It and everything in it return a 404 error even though the folder is there.
If I change the name of the folder, e.g. 'statics', all is well. I have other servers (Ubuntu) running Apache and I do not have this problem.
The site is a copy of one of the sites on one of our Linux servers. What can I do or change to allow the directory to work as named?
EDIT vhosts.conf
<VirtualHost *:8080>
ServerAdmin jablanchard#foo.com
DocumentRoot "C:/xampp/htdocs/home/app/gateway"
ServerName localhost
ServerAlias 127.0.0.*
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
<Directory C:/xampp/htdocs/home/app/gateway/>
# allow .htaccess overrides to work
AllowOverride All
DirectoryIndex login.html index.html index.php
</Directory>
# this matches a link to any project directory to the physical webui directory
AliasMatch ^/projects/([-\w]*)/(.*)$ /home/src/gateway/webui/$2
<Directory /home/src/gateway/webui>
DirectoryIndex home.html
Options All
AllowOverride All
Require all granted
</Directory>
I was getting ready to re-install XAMPP but made one last pass through the config files for Apache. I found the problem was this bit of code in the httpd.conf file -
Alias "/static" "C:/xampp/htdocs/static"
<Directory "C:/xampp/htdocs/static">
AllowOverride All
Require all granted
</Directory>
I am not sure if this is part of the XAMPP install as all of the edits I have made to this installation are in the vhosts file. Once commented out the static directory, as I have defined it, works properly now.

virtualhost not using htaccess on fedora 19

I've recently switched over to a fedora 19 cloud server service and got most things squared away except for htaccess. Am I doing this wrong or missing something?
This is what i have updated in my httpd.conf file
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
And Here is my VirtualHost telling it what folder structure and which file to use for htaccess
<VirtualHost *:80>
DocumentRoot /var/www/vhosts/domain.com/httpdocs
ServerName www.domain.com
ServerAlias www.domain.com
<Directory /var/www/vhosts/domain.com/vhosts/>
AllowOverride All
Order allow,deny
allow from all
</Directory>
AccessFileName .htaccess
</VirtualHost>
I've thrown random junk into my htaccess and I do not get a 500 error so I know its not getting read.
Your document root is:
/var/www/vhosts/domain.com/httpdocs
And your <Directory> container is for:
/var/www/vhosts/domain.com/vhosts/
Are those supposed to be different? If your htaccess file is in the httpdocs directory, then that directory doesn't have the AllowOverride All associated with it. If your htaccess file is in the vhosts directory, then it's not being accessed when you go to your website.

cannot find apache conf.d file in mac

I am using MAMP on MAC OSX.
I am trying to create a virtual host using the code. It is in a file named LaravelTest.conf. However I will need to place this file in apache's conf.d directory (I believe).
<VirtualHost 127.0.0.2>
DocumentRoot "/Applications/MAMP/htdocs/l4/project/public"
ServerName LaravelTest
<Directory "/path/to/laravel/project/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
</Directory>
</VirtualHost>
Where do I find the conf.d directory ? It is not present in /etc/apache2
Since you are using mamp, you could find the Apache configuration file at
/Applications/MAMP/conf/apache/httpd.conf
To be able to include your vhost file, you should add the following on the config
Include /path/of/LaravelTest.conf
Or you can just add an additional VirtualHost on your apache config file.

.htaccess doesnot read by apache

My .htaccess file contains garbages value like
'dfdfsdfdsfdfdf'
Another file httpd.conf(/etc/apache2/httpd.conf) contains nothing
I expect at least .htaccess file to execute and display page as
internal server error
I also changed my code and change both file(.htaccess and httpd.conf) but the page index.php is displaying as if there is no both files(.htaccess and httpd.conf).
What is the cause?
httpd.conf should contain AllowOverride All for document root directory.
DocumentRoot "D:/Projects/Example/htdocs"
<Directory "D:/Projects/Example/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Otherwise, usage of .htaccess files is disabled.
I made it to work by modifying /etc/apache2/sites-available/default
AllowOverride All on
Directory /var/www/ And Directory /

Apache do not show README.TXT files in directory listing. How can i enable it?

In CentOS 6.0, i have apache for allowing to download drivers + one README.TXT file. But when the site is visited as http://site.mooo.com/ it shows all zip files but not the TXT file.
<VirtualHost *:80>
ServerName site.mooo.com
ServerAlias site.mooo.com
DocumentRoot /var/www/html/download
<Directory /var/www/html/download>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Should show all, but only shows two zip file
/var/www/html/download/
driver.zip
driver.new.zip
README.TXT
I know it's old, but for what it's worth :
Edit your httpd.conf file
Locate the line with the IndexIgnore directive
Remove README* from that pattern
=> It will display the README.txt files.
create a .htaccess, try Options +Indexes