LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-26-2006, 08:36 AM   #1
Danny-T
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 0
Suse 10.1 - Apache "Access Forbidden!" on any page


I've been battling with this for best part of three days now, apologies for the long post, and apologies for any stupidity, I'm very new to Linux...

How I got to my problem:

Installed Suse 10.1 (first ever try with anything linux)
Installed Xampp - worked fine but I needed mySQL4 and fancied doing a 'proper' setup.
Uninstalled Xampp
Not entirely sure of the exact order but in around about way something like this happened:
- nothing worked (coudln't get any pages served)
- php scripts worked & pages were hosted
- phpMyAdmin worked with security warnings
- fixed security issues - nothing worked
- everything worked
- tried to use Yast http server management to setup multiple virtual hosts
- nothing worked

Now all i can get is :
Code:
Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
Fri May 26 14:03:39 2006
Apache/2.2.0 (Linux/SUSE)
Here is a summary of my investigations so far:
Thanks for all the suggestions, but I appear to have completely screwed things up.

Sorry for the long post but trying to provide as much info as possible so someone might be able to spot the mistake:

Not running the same IP as a printserver.
Apache is installed: -
Code:
buster2:/etc # rpm -q apache2
apache2-2.2.0-21
Apache seems to be running: -
relevant selection:
Code:
buster2:/etc # ps -ef 
wwwrun    3672  3671  0 08:40 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun    3673  3671  0 08:40 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun    3674  3671  0 08:40 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun    3675  3671  0 08:40 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun    3676  3671  0 08:40 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc

wwwrun    5546  3671  0 09:12 ?        00:00:00 /usr/sbin/httpd2-prefork -f /etc
Currently my OWNER of the htdocs files is wwwrun (have tried as root and my default user):
Code:
buster2:/etc # cd /srv/www/htdocs
buster2:/srv/www/htdocs # ls -la
total 5
drwxr-xr-x  5 wwwrun www  256 2006-05-26 08:15 .
drwxr-xr-x  5 root   root 120 2006-05-23 10:52 ..
lrwxrwxrwx  1 root   root  31 2006-05-26 08:15 dannyt -> /home/dannyt/public_html/dannyt
drwxr-xr-x 16 wwwrun www  592 2005-04-09 05:59 dotproject
drwxr-xr-x  2 wwwrun www  208 2006-05-23 11:26 gif
-rw-r--r--  1 wwwrun www    6 2006-05-25 20:09 index.htm
-rw-r--r--  1 wwwrun www    0 2006-05-24 14:42 index.htm~
-rw-r--r--  1 wwwrun www    0 2006-05-24 14:42 indexold.htm~
drwxr-xr-x  7 wwwrun www  440 2006-05-25 20:20 phpMyAdmin
I have "Others" allowed "Read" access on the htdocs directory.
here is my /etc/apache2/httpd.conf file
Code:
#
# /etc/apache2/httpd.conf 
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See  for detailed information about
# the directives.

# Based upon the default apache configuration file that ships with apache,
# which is based upon the NCSA server configuration files originally by Rob
# McCool. This file was knocked together by Peter Poeml <poeml+apache@suse.de>.

# If possible, avoid changes to this file. It does mainly contain Include
# statements and global settings that can/should be overridden in the
# configuration of your virtual hosts.


# Overview of include files, chronologically:
#
# httpd.conf
#  | 
#  |-- uid.conf  . . . . . . . . . . . . . .  UserID/GroupID to run under
#  |-- server-tuning.conf  . . . . . . . . .  sizing of the server (how many processes to start, ...)
#  |-- sysconfig.d/loadmodule.conf . . . . .[*] load these modules
#  |-- listen.conf . . . . . . . . . . . . .  IP adresses / ports to listen on
#  |-- mod_log_config.conf . . . . . . . . .  define logging formats
#  |-- sysconfig.d/global.conf . . . . . . .[*] server-wide general settings
#  |-- mod_status.conf . . . . . . . . . . .  restrict access to mod_status (server monitoring)
#  |-- mod_info.conf . . . . . . . . . . . .  restrict access to mod_info
#  |-- mod_usertrack.conf  . . . . . . . . .  defaults for cookie-based user tracking
#  |-- mod_autoindex-defaults.conf . . . . .  defaults for displaying of server-generated directory listings
#  |-- mod_mime-defaults.conf  . . . . . . .  defaults for mod_mime configuration
#  |-- errors.conf . . . . . . . . . . . . .  customize error responses
#  |-- ssl-global.conf . . . . . . . . . . .  SSL conf that applies to default server _and all_ virtual hosts
#  |
#  |-- default-server.conf . . . . . . . . .  set up the default server that replies to non-virtual-host requests
#  |    |--mod_userdir.conf  . . . . . . . .  enable UserDir (if mod_userdir is loaded)
#  |    `--conf.d/apache2-manual?conf  . . .  add the docs ('?' = if installed)
#  |
#  |-- sysconfig.d/include.conf  . . . . . .[*] your include files 
#  |                                             (for each file to be included here, put its name 
#  |                                              into APACHE_INCLUDE_* in /etc/sysconfig/apache2)
#  |
#  `-- vhosts.d/ . . . . . . . . . . . . . .  for each virtual host, place one file here
#       `-- *.conf . . . . . . . . . . . . .     (*.conf is automatically included)
#
#
# Files marked[*] are created from sysconfig upon server restart: instead of
# these files, you edit /etc/sysconfig/apache2



#  Filesystem layout:
#
# /etc/apache2/
#  |-- charset.conv  . . . . . . . . . . . .  for mod_auth_ldap
#  |-- conf.d/
#  |   |-- apache2-manual.conf . . . . . . .  conf that comes with apache2-doc
#  |   |-- mod_php4.conf . . . . . . . . . .  (example) conf that comes with apache2-mod_php4
#  |   `-- ... . . . . . . . . . . . . . . .  other configuration added by packages
#  |-- default-server.conf
#  |-- errors.conf
#  |-- httpd.conf  . . . . . . . . . . . . .  top level configuration file
#  |-- listen.conf
#  |-- magic
#  |-- mime.types -> ../mime.types
#  |-- mod_autoindex-defaults.conf
#  |-- mod_info.conf
#  |-- mod_log_config.conf
#  |-- mod_mime-defaults.conf
#  |-- mod_perl-startup.pl
#  |-- mod_status.conf
#  |-- mod_userdir.conf
#  |-- mod_usertrack.conf
#  |-- server-tuning.conf
#  |-- ssl-global.conf
#  |-- ssl.crl/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Revocation Lists (CRL)
#  |-- ssl.crt/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificates
#  |-- ssl.csr/  . . . . . . . . . . . . . .  PEM-encoded X.509 Certificate Signing Requests
#  |-- ssl.key/  . . . . . . . . . . . . . .  PEM-encoded RSA Private Keys
#  |-- ssl.prm/  . . . . . . . . . . . . . .  public DSA Parameter Files
#  |-- sysconfig.d/  . . . . . . . . . . . .  files that are created from /etc/sysconfig/apache2
#  |   |-- global.conf
#  |   |-- include.conf
#  |   `-- loadmodule.conf
#  |-- uid.conf
#  `-- vhosts.d/ . . . . . . . . . . . . . .  put your virtual host configuration (*.conf) here
#      |-- vhost-ssl.template
#      `-- vhost.template



### Global Environment ######################################################
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.

# run under this user/group id
Include /etc/apache2/uid.conf

# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
Include /etc/apache2/server-tuning.conf

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog /var/log/apache2/error_log

# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf

# IP addresses / ports to listen on
Include /etc/apache2/listen.conf

# predefined logging formats
Include /etc/apache2/mod_log_config.conf

# generated from global settings in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/global.conf

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf

# optional cookie-based user tracking
# read the documentation before using it!!
Include /etc/apache2/mod_usertrack.conf

# configuration of server-generated directory listings
Include /etc/apache2/mod_autoindex-defaults.conf

# associate MIME types with filename extensions
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf

# set up (customizable) error responses
Include /etc/apache2/errors.conf

# global (server-wide) SSL configuration, that is not specific to 
# any virtual host
Include /etc/apache2/ssl-global.conf

# forbid access to the entire filesystem by default
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.html index.html.var index.htm

### 'Main' server configuration #############################################
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
Include /etc/apache2/default-server.conf


# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf


### Virtual server configuration ############################################
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
Include /etc/apache2/vhosts.d/*.conf
 
Old 05-26-2006, 09:01 AM   #2
PerfectStranger
LQ Newbie
 
Registered: Dec 2005
Distribution: SuSE
Posts: 20

Rep: Reputation: 0
Woah! Well, I couldn't see anything wrong by scanning through your post information. It could be just something simple you've missed, however with all of the changing of configurations, etc... it seems like uninstalling apache/php/phpmyadmin/mysql/xampp/whateverelseyouinstalled and starting over may be a good idea.

I don't know if this will help at all, but I've configured this stuff numerous times on SuSE 10 and I do it pretty much the same way every time; if you follow these steps you shouldn't have to worry about using something like xampp and it may just help fix your issue:

1. Install apache2 through YaST (plus prefork/worker dependencies) -- I usually don't do this from the Network Services --> HTTP Server setup, but just type "apache2" in the yast software management panel to find and install it
2. Make sure you start apache up (/etc/init.d/apache2 start) and then put a simple index.html file in your /srv/www/htdocs directory. Open it in a browser locally (http://localhost) and see if you can see it. (Remember if you want to access your pages from a machine other than the one you are on you need to enable HTTP traffic in your firewall settings).
3. Install PHP5 and the apache_php5 module (again from YaST software management)
4. If you want, add index.php to your apache conf file (DirectoryIndex index.html index.php index.html.var)
5. Restart apache (/etc/init.d/apache2 restart)
6. Put a simple test.php file (something like <?php phpinfo(); ?>) in your /srv/www/htdocs/ directory.
7. Open up your local browser again (http://localhost/test.php) and make sure apache serves that page correctly
8. Install mysql through YaST software management and make sure it is running (/etc/init.d/mysql start)
9. Now go to phpmyadmin.net and download the latest phpMyAdmin tar file (I always get it from here because I have had numerous problems trying to install phpMyAdmin from YaST)
10. Install phpMyAdmin (basically untar in your /srv/www/htdocs/ directory and rename to "phpMyAdmin" or whatever you want)
11. Change your phpMyAdmin user and password settings and permissions to get rid of those security warnings
12. Restart apache again and access your localhost/phpMyAdmin page.

Well, that's about it. Once you get to that point I would recommend setting up your virtual hosts, etc...

Hope that helps.

Last edited by PerfectStranger; 05-26-2006 at 09:06 AM.
 
Old 05-26-2006, 09:51 AM   #3
Danny-T
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
I had just tried starting again from scratch, basically i:
uninstalled apache,
uninstalled phpMySql,
uninstalled mysql
all using Yast.
Then deleted the entire /etc/apache2 folder.

I then reinstalled everything using yast and I get the same REALLY frustrating error.

However I will try your approach and follow it to the T.

Thanks
 
Old 05-26-2006, 01:03 PM   #4
iuaui
Member
 
Registered: Sep 2005
Location: Nummela, Southern Finland
Distribution: Fedora Core 4, Fedora Core 5, Redhat 9.0, Solaris 10, WInXP pro, W2k pro
Posts: 30

Rep: Reputation: 15
Hello,
It would be usefull if you could post what is inside in your /etc/apache2/default-server.conf -file.
This because I do not see any document root in your httpd.conf and there is
Code:
# forbid access to the entire filesystem by default
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
which bothers me a lot. I have never seen configuration like that.
 
Old 06-01-2006, 12:31 AM   #5
varange
LQ Newbie
 
Registered: Oct 2005
Posts: 12

Rep: Reputation: 0
Yep, the problem often exists with making sure that a directory is readable.

For example, if your pages are in /home/website, in order for the webserver to display them, two things need to happen: the webserver has to be told where they are (either through DocumentRoot or through a Virtual Server), and then the "allow from all" directive has to be set in httpd.conf.

Here's a typical example:

<Directory "/home/website">
AllowOverride All
Order allow,deny
allow from all
</Directory>

Only setting permissions is not going to be enough.

Hope this helps
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Apache web access "Forbidden" wswartz Linux - Software 21 10-27-2011 10:52 AM
Apache Server only displaying "Test" page. Fedora Core 4 Tear Syden Linux - Newbie 2 03-17-2006 07:40 PM
can't log into squirrelmail. error code "You must be logged in to access this page." rioguia Linux - Software 3 11-02-2004 10:47 AM
Apache 2, "Forbidden" TazG Linux - Software 2 05-30-2004 07:33 PM
Uploading web pages; get "access forbidden" when I load them in browser! Thermodynamic Linux - Software 1 04-03-2004 05:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:47 AM.

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