LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-21-2013, 09:02 PM   #1
shams
Member
 
Registered: Jan 2004
Posts: 537

Rep: Reputation: 30
Exclamation apache2 error: Forbidden


I just installed the kubuntu 13.10 and did the full dist upgrade, apache2 was working normal in kubuntu 13.04, in the 13.10 i see some changes like the example.net is changed to the example.net.conf in apache2 configurations, now want to open the exmaple.net with apache2 server get this error:
Quote:
Forbidden

You don't have permission to access / on this server.
Apache/2.4.6 (Ubuntu) Server at example.net Port 80
The doument root /home/www permission is set to 755, this is the /etc/apache2/sites-enabled/example.net.conf:
Quote:
<VirtualHost *:80>
ServerAdmin user@example.net

DocumentRoot /home/www/example.net/htdocs
ServerName example.net
ServerAlias www.example.net
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/home/www/example.net/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</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

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>
The host from /var/www is working fine, the problem is with the virtualhosts.
 
Old 10-21-2013, 11:14 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,534

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
Check the owner:group on /home/www. The group at least needs to be apache or www-data, whatever Ubuntu uses.
 
Old 10-22-2013, 12:35 AM   #3
shams
Member
 
Registered: Jan 2004
Posts: 537

Original Poster
Rep: Reputation: 30
I changed the ownership of /home/www to www-data:www-data but still the same problem.
 
Old 10-22-2013, 02:05 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by shams View Post
I changed the ownership of /home/www to www-data:www-data but still the same problem.
You docroot is outside of the default docroot (/var/www), so you need to add:
Code:
<Directory /home/www/example.net/htdocs>
Allow from all
</Directory>
 
Old 10-22-2013, 10:41 AM   #5
passinthru
Member
 
Registered: Oct 2013
Location: Mid-Atlantic USA
Distribution: various debians and *buntus
Posts: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
You docroot is outside of the default docroot (/var/www), so you need to add:
Code:
<Directory /home/www/example.net/htdocs>
Allow from all
</Directory>
Not to hijack this thread, but I am apparently having the same issue, though the default file the op shows is not the same as the one I have. What version of apache2 does kubuntu include?

The apache2 sites-available directory, part of the tasksel LAMP install under Xubuntu 13.10:
Code:
/etc/apache2/sites-available/
├── 000-default.conf
├── 000-mysite.conf
├── default-ssl.conf
└── mysite (my copy of 000-default.conf)
The 000-default.conf file:
Code:
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
All that I have been able to determine comes from the Apache2 site documentation, and it says that a2dissite and a2ensaite have been deprecated. I can not find how to enable a virtual host.

a2dissite and a2ensite are still present but will not enable the virutal site with any configuration of 000-<mysite>.conf.

Where do I put the docroot, and then what do I do?

How do I make /home/<user>/www the virtual site in Apache2.4.6 as I was able to do up to Apache2.2.22(Ubuntu) - up to and including xubuntu 13.04?
 
Old 10-22-2013, 01:16 PM   #6
passinthru
Member
 
Registered: Oct 2013
Location: Mid-Atlantic USA
Distribution: various debians and *buntus
Posts: 51

Rep: Reputation: Disabled
I may have run across a solution to my probleem (and hopefully yours) at http://ubuntuforums.org/showthread.php?t=2182652. I have not tried it yet... hope it works.
 
Old 10-22-2013, 02:11 PM   #7
passinthru
Member
 
Registered: Oct 2013
Location: Mid-Atlantic USA
Distribution: various debians and *buntus
Posts: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by passinthru View Post
I may have run across a solution to my probleem (and hopefully yours) at http://ubuntuforums.org/showthread.php?t=2182652. I have not tried it yet... hope it works.
Having already checked the owner/group and permissions, I tried the above and am still getting the "Forbidden" error on my virtual site. It is now enabling the site, which it would not do before, but I still can not access it. (Can you wear out a service reloading it? Just kidding.)
 
Old 10-23-2013, 08:58 PM   #8
shams
Member
 
Registered: Jan 2004
Posts: 537

Original Poster
Rep: Reputation: 30
I added the lines below to the /etc/apache2/apache2.conf:
Quote:
<Directory /home/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and changed the 000-default.conf to my virtual host:
Quote:
<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /home/www/example.net/htdocs
ServerName example.net

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
and changed the permissions of /home/www to 644, all virtual hosts working now. to enable the site run the command a2ensite from the sites-available directory.
 
Old 10-24-2013, 03:10 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
and changed the permissions of /home/www to 644, all virtual hosts working now
Huh? Directory permissions should be 755 for apache to work.
You can set 644 the files accessible by apache.
 
Old 10-24-2013, 05:49 AM   #10
passinthru
Member
 
Registered: Oct 2013
Location: Mid-Atlantic USA
Distribution: various debians and *buntus
Posts: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by shams View Post
I added the lines below to the /etc/apache2/apache2.conf:

and changed the 000-default.conf to my virtual host:

and changed the permissions of /home/www to 644, all virtual hosts working now. to enable the site run the command a2ensite from the sites-available directory.
Following these recommendations has not made it work for me.

The user is in the www-data group (xubuntu 13.10), and I've tried both 644 and 755 permissions.

I tried using a duplication of the virtual site configuration file which works under 13.04/apache2.2.22(Ubuntu), and various changes of the file variables.

With everything I have done I get either "Forbidden" or "Not found". I am retracing my steps to learn under what configuration I get which, hoping that something will "click".

At present, the only way I can access the files which were my virtual site is by putting a symlink in /var/www which points to them.

(My need for a local server is simply to have a mirror of several remote websites which I maintain. So I do not think that security is a real concern for me, is it?)
 
Old 10-24-2013, 06:16 AM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Try it with SELINUX disabled.
 
Old 10-24-2013, 06:38 AM   #12
passinthru
Member
 
Registered: Oct 2013
Location: Mid-Atlantic USA
Distribution: various debians and *buntus
Posts: 51

Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Try it with SELINUX disabled.
Can you tell me specifically how to disable SELINUX? (If this is not the place to ask such a stupid question, then I must either dismiss the suggestion or go elsewhere to learn how to follow it. At this point I am not primarily interested in knowing what it is and what it does; I simply want a properly functioning local web server with my chosen os.)
 
Old 10-24-2013, 06:54 AM   #13
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
To permanently disable SElinux you need to edit SElinux's config file /etc/selinux/config and add/alter line disable it:
Code:
SELINUX=disabled
and then reboot the server.
 
Old 10-24-2013, 06:57 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
@passinthru
Take a look here to see what you have to change in your apache configuration when upgrading from 13.04 to 13.10

@TenTenths
Ubuntu does not use SELinux
 
Old 10-24-2013, 06:59 AM   #15
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by bathory View Post
@TenTenths
Ubuntu does not use SELinux
Ooops! Well there ya go, that's my "learn something new today"

Maybe I should get my head out of RHEL/CentOS land
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2: Access forbidden! Error 403 vous Linux - Server 4 10-11-2011 04:46 AM
403 forbidden error with apache2 shifter Programming 4 01-22-2010 05:22 AM
403 forbidden error with apache2 shifter Linux - Networking 1 01-20-2010 02:56 PM
apache2 and forbidden error on subdirectories tsimm Linux - Newbie 2 09-05-2004 08:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration