apache 2.4.10 error 403 on aliases - apache

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/>

Related

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 http.conf - Route Requests to URL Directory Using Alias

I have a web application that I would like to be accessed in the following format:
52.1.2.3/myapplication
I currently have a httpd.conf that looks like
<VirtualHost *:80>
DocumentRoot /var/www/myapp/public_html
ServerName 52.1.2.3
ServerAlias 52.1.2.3
Alias /myapplication /var/www/myapp/public_html
<Directory /var/www/myapp>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I got to the URL 52.1.2.3/myapplication, I want Apache to load the application stored in /var/www/myapp/public_html.
If I take out the Alias /myapplication /var/www/mya/pp/public_html configuration from the above, I can reach my web application by going to 52.1.2.3. But when I try to go to 52.1.2.3/myapp with the Alias option added in, I get a 403 Forbidden response.
How would you bind 52.1.2.3/myapplication to /var/www/myapp/public_html?
in my understanding you have to add the same path to the directory which you have used for the alias.
So,your path for alias /myapplication is /var/www/myapp/public_html.So put the same in below directory :
<Directory /var/www/myapp/public_html>
Options +Indexes +FollowSymLinks +MultiViews
Order allow,deny
Allow from all
</Directory>

apache2 is throwing internal server error 500 after AllowOverride All, localhost

i am new in configuring server. For now, i have to configure localhost with LAMP and opencart framework. But still it is throwing internal server error 500.
Even I have tried the following things
sudo a2enmode rewrite
apache2ctl configtest // for syantax
apache2ctl -t // for syntax
/etc/apache2/sites-available/000-default.conf file
ServerName localhost
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
<Directory "/var/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
/etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
/var/www/opencart/.htaccess
Options +FollowSymLinks
Header add Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteBase /ot
RewriteCond $1 !^(robots\.txt)
After checking the logs, i have found invalid parameters headers. Therfore for this we have to this:
sudo a2enmode headers

Apache2 Option index on centos 6.3

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>