How to allow Apache to serve files outside of the document root folder? - apache

everybody. TIA for your help.
All of my projects are located in /var/www/html and my apache.conf points to it with the following directive:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
By mistake I created another project in ~/Development/My_Project.
And I tried to get apache to serve the files using the following directive (right after the one above):
<Directory /Development/My_Project/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
But it does not work. I get:
Forbidden
You don't have permission to access / on this server.
I appreciate any help.
Thanks

Related

How to set Apache configurations in .htaccess file

I build a small project and it s working fine in Localhost, but not in a Share Hosting because of some configurations in the Apache config file.
Because this Hosting Service doesn't allow access to httpd.conf file, i could only use .htaccess file to do it.
My config in the local environnent:
<Directory "/path/to/the/site/directory/">
Options Indexes
FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
I have tried to use a htaccess file like below:
Options -Indexes
FollowSymLinks MultiViews
AllowOverride All //seems not to be working
Require all granted
I would really appreciate it if anyone can help. Thanks so much.

Ubuntu 14.04 Apache 2.4.7 404 Not Found

I've been reading the forums and trying to replicate their fixes, but I must be missing something on my end since it will switch from a simple 404 Error Not Found to a 403 Forbidden Error (even after chown and chmod changes).
Currently, I am experiencing the 403 error code even after a sudo apache2ctl restart
Here is what I've done so far.
- gedit apache2.conf with the following
<Directory /path/to/directory/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
gedit sites-available/000-default.conf && sites-enabled/000-default.conf
DocumentRoot /path/to/directory
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /path/to/directory>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
Any help is much appreciated.
First note that you have now Apache 2.4, not Apache 2.2. The style to declare permissions has changed with Apache 2.4 and you should consistently use the new ones (like require all granted).
Apache has become more strict in what files it allows to be served. Essentially, arrange the files to be served outside in your Document Root and below, and keep all other files out of this tree. Don't link to files outside the Document Root tree.
Some point of your config:
<Directory />
This is the root directory of your file system. If you declare anything for it, it should be require all denied and nothing else. Note that there is a difference between a <Directory /absolute/path/to/some/directory> directive and a <location /relative/path/to some/location/on/your/server> directive.
Configure your server in terms of <location>

You don't have permission to access /files/theme/icons on this server

I've recently got an error on my site while trying to get Apaxy to work.
After a while I realized that the icons are not accessible. When I try to open them I get this error message:
Error
You don't have permission to access /files/theme/icons on this server.
This is a part of my apache2.conf (httpd.conf) and everything seems alright in it:
Code
<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 None
Require all granted
</Directory>
<Directory /var/www/html/>
AllowOverride All
Require all granted
</Directory>
I tried everything I found on SO but it didn't work.
I'm not overriding the permissions with any .htaccess file.
I'm running Apache 2.4.7
I solved this problem by changing permissions to read+execute.

Apache 2.4 - Forbidden (WAMP)

Unable to get Apache 2.4 to work properly.
Localhost it works great. I can see my website no problem. However if i have another computer try to communicate with the server i get the following error:
Forbidden
You don't have permission to access /test on this server.
I have done some research and tried many options on the http.conf file.
I know this is unsafe but I am trying to get this to work I can improve security once I can establish some sort of connection.
My configuration file directory looks like this:
<Directory />
Require all granted
</Directory>
DocumentRoot "c:/wamp64/www"
<Directory "c:/wamp64/www/">
Require all granted
</Directory>
Any help is greatly appreciated. Thanks in advanced!
You need to add that directory as well.
Finally got it working this is what my config looks like and hopefully this works for you.
<Directory />
AllowOverride none
Require all granted
</Directory>
DocumentRoot "c:/wamp64/www"
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory "c:/wamp64/www/test">
Require all granted
</Directory>

.htaccess not workingn on Ubuntu

I have tried several things now but my .htaccess file still seems to be having no affect on the website.
in apache2/apache2.conf I have changed AllowOverride to ALL
I have copied the following into my default file in sites-available
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I have also added the following into my sites conf file in sites-enabled...
<Directory /var/www/html/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
But still nothing!
I have also checked phpinfo() for the server and mod_rewrite is appearing in the loaded modules
I have also made sure to restart apache.