Forbidden You don't have permission to access / on this server. [Apache/2.2.22 (Debian)] - apache

Tried all alternatives still couldn't resolve. The following error i'm getting:-
Forbidden You don't have permission to access / on this server. [Apache/2.2.22 (Debian)]
This is my default file placed under /etc/apache2/sites-enabled. The media folder is path to my remove-able disk drive named XYZ.
<VirtualHost *:80>
ServerAdmin webmaster#loclahost
DocumentRoot /media/XYZ/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /media/XYZ/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined

default file in sites enabled directory is fine and working with virtualhost.It was permission related issue.Though permissions were granted but it was not being updated.
The problem was caused as filetype was ntfs and after formatting to ext4 format and giving permission to directory. problem got resolved.
Conclusion.
If facing such issue check file format and check permissions to directory are updated.Thanks.

Related

Change AllowOverride None to AllowOverride All

These two file have the same code inside.
/etc/apache2/sites-enabled/000-default
/etc/apache2/sites-available/default
I would like to change AllowOverride None to AllowOverride All.
Which file should I change?
Is all the AllowOverride None change to AllowOverride All?
<VirtualHost *:80>
DocumentRoot /var/www/drupal
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/drupal>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
/etc/apache2/sites-enabled/000-default
/etc/apache2/sites-available/default
Actually these are not 2 files. One is a symlink of the other. So that is why they are exactly the same.
The sites-available just shows which sites you have on your system. But sites-enabled show which one's are in use.
So just change the original in sites-available because they are the same file. And yes use AllowOverride All to enable .htaccess use under <Directory /var/www/drupal> block.
You can use commands a2ensite and a2dissite to enable and disable sites if you add more later. The link below gives exact instructions if you ever need to do that, which you shouldn't since your site is live.
http://manpages.ubuntu.com/manpages/trusty/man8/a2ensite.8.html

Apache 2.4.7 403 Forbidden Error

I'm trying to install the overpass api as a web server with apache (http://wiki.openstreetmap.org/wiki/Overpass_API/install)
Here is my 000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ExtFilterDefine gzip mode=output cmd=/bin/gzip
DocumentRoot /root/osm-3s_v0.7.4/html
# This directive indicates that whenever someone types http://www.mydomain.com/api/
# Apache2 should refer to what is in the local directory [YOUR_EXEC_DIR]/cgi-bin/
ScriptAlias /api/ /srv/osm3s/cgi-bin/
# This specifies some directives specific to the directory: [YOUR_EXEC_DIR]/cgi-bin/
<Directory "/srv/osm3s/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
#SetOutputFilter gzip
#Header set Content-Encoding gzip
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/access.log combined
However when I try to run the command:
http://175.33.148.57/api/interpreter?data=%3Cprint%20mode=%22body%22/%3E
I get the 403 Forbidden error.
I have already done
chmod 777 /srv/osm3s/cgi-bin/
But nothing seems to work.
Please help, Ive been stuck on this for 3 days now! Thanks in advance.
Replace:
Allow from all
by
Require all granted
<Directory /www/mysite>
Allow from All
</Directory>
<Directory /www/mysite>
Require all granted
</Directory>
Here is how I solved this problem for anyone who might have a similar one:
It seemed the problem came from where I installed the overpass installation ($EXEC_DIR).
So I had to change the install directories to:
$EXEC_DIR /var/www/osm/
$DB_DIR /var/www/osm/db/
$PLANET_FILE /var/www/osm/planet.osm.bz2
$REPLICATE_DIR /var/www/osm/rep/
Giving the resulting default.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ExtFilterDefine gzip mode=output cmd=/bin/gzip
DocumentRoot /root/osm-3s_v0.7.4/html
# This directive indicates that whenever someone types http://www.example.com/api/
# Apache2 should refer to what is in the local directory [YOUR_EXEC_DIR]/cgi-bin/
ScriptAlias /api/ /var/www/osm/cgi-bin/
# This specifies some directives specific to the directory: [YOUR_EXEC_DIR]/cgi-bin/
<Directory "/var/www/osm/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
#SetOutputFilter gzip
#Header set Content-Encoding gzip
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
I tried and tried but couldn't get it working with the old dir. Good luck!
try this as it is. don't add Order allow,deny or others
AddHandler cgi-script .cgi .py
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
Allow from all
</Directory>

Apache : client denied by server configuration for some local ressources

i have some troubles to install local website for development.
I have an "client denied by server configuration"' error for some local ressources like .png or .js
My website have following treepath :
website/files
website/app/local
website/app/share
My mainpage is in app/local and can access to files /files but i have 403 error for files in app/share.
I put "chmod -R 777 www-data" on full website directory so what's wrong ?
[SOLVING]I have another little problem : i can't access to my website with localhost/website but only with localhost/
I have reading some tutos and think my following configuration is right (my apache is 2.2) :
<VirtualHost *:80>
ServerName julien.quai13.com
DocumentRoot /home/julien-quai13/www
<Directory />
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin julien#andcotransport.com
ServerName julien.quai13.com/andcotransport
DocumentRoot /home/julien-quai13/www/andcotransport
#<Directory />
# Options FollowSymLinks
# AllowOverride All
#</Directory>
<Directory /home/julien-quai13/www/andcotransport>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And this my /etc/hosts :
127.0.0.1 localhost
127.0.0.1 julien.quai13.com
127.0.1.1 julien-quai13
192.126.0.34 julien.quai13.com
Not very important but annoying, i always have problems when i switch of Wamp to Linux.
Thanks for helping (promise i stay on Linux this time ;)
Well, when using vhosts, if apache doesn't match the URL with any server name, it will serve the first one it comes to, if this is the first one, then localhost will map straight to /home/julien-quai13/www/andcotransport
You should set up a virtualhost for default with DocumentRoot /home/julien-quai13/www and add a Directory directive for this directory, then localhost/andcotransport will work.
Not sure if this is what you meant to write: chmod -R 777 www-data but this is wrong, commands should be chmod -R 755 /home/julien-quai13/www/andcotransport and chown -R julien-quai13:www-data /home/julien-quai13/www/andcotransport
But permissions wouldn't give you a client denied by server configuration error, this is down to allow being set incorrectly.
Also you have defined julien.quai13.com twice in your hosts file.. one points to 127.0.0.1 and another points to 192.126.0.34.. this may be another problem..
Otherwise i'd consider restructuring your vhosts.
Judging by your vhost:
<VirtualHost *:80>
ServerName julien.quai13.com
DocumentRoot /home/julien-quai13/www
<Directory /home/julien-quai13/www>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
You don't actually need the second vhost unless its under a different domaing, like andcotransport.julien.quai13.com so, just use the default domain and pass everything to /andcotransport, if thats how you want to do it...
but make sure all your resources are going to /andcotransport/files and /andcotransport/app/share then this should work, unless you have an overriding ACL somewhere which is blocking directories.

Unable to install self-signed SSL Cert. Apache Error

I am trying to install a self signed cert I generated using these instructions here:
http://www.akadia.com/services/ssh_test_certificate.html
I have the cert ready and have reread the instructions several times. However, the one difference is that I'm putting mine in /etc/apache2/conf.d/security/
I get the following error from apache.
Syntax error on line 1 of /etc/apache2/conf.d/security/server.crt:
Invalid command '-----BEGIN', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
Any clues? I'm in Ubuntu 11.04 running the latest lamp installation from tasksel. (vhosts in sites-available and such). I also have also made sure that ssl is enabled using a2enmod ssl. It said that it was already enabled.
------------VHOST---------------
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName www.cmp.me
SSLEngine on
SSLCertificateFile /etc/apache2/conf.d/security/server.crt
SSLCertificateKeyFile /etc/apach2/conf.d/security/server.key
DocumentRoot /var/www/sites/www.cmp.me
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/sites/www.cmp.me>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/www/errors/cmp-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

How can i move Apache localhost from /var/www to my mount directory

I am new in ubuntu(and Linux) and have simple-lamer question.
I have mounted directory /media/2A98EDD2ACA90087/WebProject/ and would like to move http:/localhost/ from var/www to /media/2A98EDD2ACA90087/WebProject/
I have change sites-enabled/000-default and /etc/apache2/sites-available
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /media/2A98EDD2ACA90087/WebProject
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /media/2A98EDD2ACA90087/WebProject>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
And have this apache message!
Forbidden
You don't have permission to access / on this server
When i have created "test" dir and move localhost from var/www to var/www/test - everything works. I suppose that problem with file permissions??!What should i do?
The problem has been solved. Thanks Patrick and Joh. Really need to give read access to index.html: chmod 644 /media/2A98EDD2ACA90087/WebProject/index.html
But i can't change access to my Ntfs mounted drive. I have to remount
why cant change permission ownership group of external hard drive on ubuntu
The apache server runs as a certain user -- probably "apache", you can run ps to see -- and that user must have permission to access the webroot. You can make it be owned by apache, or make it group-readable (and you'll probably want it group-writable) and either add apache to the group that owns it, or change the group to apache's group.
Assuming httpd runs as "apache" (group: apache) and you are "jdoe" (group: jdoe)
$ sudo chown -R jdoe:apache /media/2A98EDD2ACA90087/WebProject
$ sudo chmod -R 755 /media/2A98EDD2ACA90087/WebProject