Apache2 Option index on centos 6.3 - indexing

On a newly installed Centos 6.3
I imported the config from Ubuntu for a virtualhost. Here is the piece of config
DocumentRoot /otherhome/test.cofares.net
ServerName test.cofares.net
<Directory "/otherhome/test.cofares.net">
allow from all
Options +Indexes
</Directory>
A request to the http://test.cofares.net I get the folowwing error in the error log
Directory index forbidden by Options directive: /otherhome/test.cofares.net/
The directory index worked for a sub directory http://test.cofares.net/test is OK
Any suggestions what is missing?
The same config work well with Ubuntu Server 12.04.

Try this. And make sure to restart apache after applying:
<Directory "/otherhome/test.cofares.net">
Options +Indexes FollowSymLinks
AllowOverride all
Order Allow, Deny
Allow from All
Satisfy All
</Directory>
And perhaps try this with Satisfy Any instead:
<Directory "/otherhome/test.cofares.net">
Options +Indexes FollowSymLinks
AllowOverride all
Order Allow, Deny
Allow from All
Satisfy Any
</Directory>
EDIT: Those didn’t seem to work? Then try this. Note I am setting up the whole <VirtualHost> directive & removed quotes from the <Directory> directive:
<VirtualHost *:80>
DocumentRoot /otherhome/test.cofares.net
ServerName test.cofares.net
<Directory /otherhome/test.cofares.net>
Options Indexes FollowSymLinks
Allow from All
</Directory>
</VirtualHost>

After digging a little I noticed that thire is a global rule (in conf.d/welcome.conf) that prevent indexing the / directory of any virtual server
By removing it it is now ok
Here is the rule that must be change
<LocationMatch "^/+$">
Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>

Related

How to properly set the allow and deny for apache 2.4 conf and vhosts

I need some advice on how to properly setup the vhosts file directives preferably without changing the apache2.conf contents. This is for apache 2.4.
Currently, I get AH01797: client denied by server configuration probably caused by the Require all denied in the apache2.conf.
apache2.conf:
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
Require all denied
</Directory>
vhosts file:
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName sub.example.com
ServerAlias sub.example.com
<Directory /var/www/sub.example.com>
AllowOverride None
Allow from all
Require all granted
</Directory>
</VirtualHost>
</IfModule>
Thank you!
UPDATE
Adding this to the apache2.conf works, it just doesn't work in vhosts file. Any idea why?
<Directory /var/www/sub.example.com>
AllowOverride None
Allow from all
Require all granted
</Directory>
In 2.4, you shouldn't use Order, Deny, or Allow at all. Purge them and replace with Require.
UPDATE Adding this to the apache2.conf works, it just doesn't work in vhosts file. Any idea why?
Maybe the vhosts file isn't included in your configuration, or mod_ssl is not loaded so the whole thing is commented out? The IfModule doesn't make much sense here.

500 Internal Server Error when trying to enable use of .htaccess in Apache on Ubuntu

I am trying to get my .htaccess working on my Ubuntu-apache2-webserver.
For that I opened /etc/apache2/apache2.conf,
I removed the comment sign (#) before AccessFileName .htaccess
and replaced AllowOverride None by AllowOverride All in
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I activated mod_rewrite via a2enmod rewrite and restarted the server.
But each time I am performing those changes and open an html-file placed inside of /var/www/html, I get a 500 Internal Server Error for Virtual Host 80.
The same thing happened to me when placing
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
before </VirtualHost> into the 000-default.conf-file instead of the /etc/apache2/apache2.conf.
Can anyone tell me what I am missing?
You're slightly off in your syntax for allowOverride. The Directory tag needs to be inside the VirtualHost tag. Like so:
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog /var/log/apache2/error.log
Options Includes
<Directory "/var/www/html">
AllowOverride All
</Directory>
</VirtualHost>
Also, make sure Apache has permissions to read and write to the directory /var/www/html

configure apache to allow directory listing

Hi installed wordpress as localhost on my machine. I wanted to access it from another machine on my LAN. I can access the page. But non of the images or css is applying, Looking in firebug it's riddled with 404 errors to all the files it required. the path specifies the IP and not Localhost and exist in their locations.
I am trying to set apache to allow file browsing via the website I have set HTTPD.CONF and .htaccess but cant get file browsing the site is located at c:\xampp\apache\htdocs
heres what I have in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
AllowOverride all
Require all granted
</Directory>
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/wordpress">
AllowOverride all
Require all granted
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/wordpress/index.php"
ServerName wordpress
</VirtualHost>
in .htaccess
Options +Indexes
the error.log doesn't contain anything that stands out to me
You have to specify the option +Indexes in the corresponding Directory:
<Directory "C:/xampp/apache/htdocs">
Options +Indexes
</Directory>

apache 2.4.10 error 403 on aliases

I updated my apache server to 2.4.10 from version 2.2.x on debian7 and I have problem with multi virtual hosts. When I try to load page I have forbidden [403] error. If I enable only one alias the page works fine, when I try to enable another page, then I received 403 error. I add to all configs Require all granted.
What I doing wrong?
code of alias 1:
<VirtualHost example.com:3099>
DocumentRoot /home/ftp/example.com
alias alias1 /home/ftp/example.com/alias1/>
<Directory /home/ftp/example.com/alias1/>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
code of alias 2:
<VirtualHost example.com:3099>
DocumentRoot /home/ftp/example.com
alias alias2 /home/ftp/example.com/alias2/>
<Directory /home/ftp/example.com/alias2/>
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
UPDATE 1
In /etc/apache2/apache2.conf I Have
<Directory />
Options FollowSymLinks
AllowOverride none
Require all denied
</Directory>
If I change denied to granted, error 403 disappear, but I have access to all subdirs in /home/ftp/example.com even they haven't virtual host alias.
UPDATE 2
I have error, when I write a post here, In server config I have proper directory location.
These parameters don't match, so the path is forbidden. Look at the last character:
alias alias2 /home/ftp/example.com/alias2/>
<Directory /home/ftp/example.com/alias1/>

Moveable type images not displayed

I installed Moveable type on a ubuntu box.
The admin section works great.
However the front page does not. The images and CSS are not displayed.
This is coming from the apache error log:
Permission denied: exec of '/var/www/mt/example/styles.css' failed
Premature end of script headers: styles.css
I think it's related to my apache config. Since i call the admin section using the localhost, but i use the example.com for the front page, which is the part that doesnt work.
This is my apache config:
NameVirtualHost *
<VirtualHost *>
ServerAdmin chris#example.com
ServerName mt.example.net
DocumentRoot /var/www/mt
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias / /var/www/mt/
<Directory /var/www/mt>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerAdmin chris#example.com
ServerName example.com
ServerAlias example.com www. example.com
DocumentRoot /var/www/example
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Redirect /mt.cgi http://mt.example.net/mt.cgi
</VirtualHost>
it because the directory where the css file is located (var/www/mt/example/) is a sub-directory of one which is declared to be a script in (/var/www/mt) with Options +ExecCGI
Directories inherit the options of their parents
It sounds like Apache has tried to run the .css file as an executable. The only thing which I can suggest is that you might have a css file which has an executable permission, for some reason, so Apache tries to execute it. Try
chmod a-x
on the CSS file and see if it makes a difference.
Sometimes files copied from Windows have executable set when they shouldn't.