LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-14-2006, 12:59 PM   #1
calculemus
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE
Posts: 17

Rep: Reputation: 0
Object not Found error when accessing localhost.


Hi,
I am using SuSE Linux 10.1 in my Dell Latitude D600 laptop. I recently installed apache, mysql and php. I wanted to test php, so I put index.php file with "<?phpinfo();?>" in my public_html folder.

When I try to access it from my browser with http://localhost/~calculemus/index.php, I get an error: Object not found! Error 404. I checke the permissions of my public_html folder and it has "rx" permissions for everyone. I then tried to put a test page, index.htm, in the public_html folder and tried to access it. It did not work either.

ould someone shed some light in this issue, please.
 
Old 10-14-2006, 01:33 PM   #2
calculemus
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE
Posts: 17

Original Poster
Rep: Reputation: 0
Here is my /etc/apache2/httpd.conf file. What I understood from Apache documentations was that public_html is set by default. Nevertheless, I tried adding "UserDir public_html" to httpd.conf file. Then the browser shows: Access denied.

#
# /etc/apache2/httpd.conf
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.2/> 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 None
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

### '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:http://httpd.apache.org/docs-2.2/vhosts/>
# 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


# Note: instead of adding your own configuration here, consider
# adding it in your own file (/etc/apache2/httpd.conf.local)
# putting its name into APACHE_CONF_INCLUDE_FILES in
# /etc/sysconfig/apache2 -- this will make system updates
# easier
 
Old 10-14-2006, 01:57 PM   #3
Blindsight
Member
 
Registered: Mar 2003
Distribution: Slackware
Posts: 234

Rep: Reputation: 30
Your config is borderline useless. Why? Because instead of declaring values in httpd.conf, it includes them from other files. Not that this is any fault of your own, or that it's wrong. I'm just pointing out that your httpd.conf is basically a list of links to other files to get config info from.

Here's the config in question.

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

Look in your uid.conf and see what user httpd is running as (most likely "nobody") it's "nobody" that you want to have access to your public_html. If you're not worried about security, chmod a+rx ~/public_html should fix your issue. If you are worried about security (and it's good to get in the practice early.) Then figure out another way to set up your file system security to allow nobody [or whoever specified in uid.conf] to access your public_html.
 
Old 10-14-2006, 11:08 PM   #4
calculemus
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE
Posts: 17

Original Poster
Rep: Reputation: 0
Thankyou blindsight for your reply.

I doubt that it is permissions because here is the result of ls-l:
drwxr-xr-x 7 calculemus users 272 2006-10-14 20:45 public_html.

uid.conf contained:
User wwwrun
Group www


I changed it to
User calculemus
Group users


Then I edited mod_userdir.conf file. The directive "Userdir public_html" was commented. I uncommented it and restarted apache server. I get error message saying "Object not found" when I try to access ....~calculemus/index.html.

I don't know if I am missing something in the mod_userdir.conf file, could someone take a look and suggest me:

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#

<IfModule mod_userdir.c>
# Note that the name of the user directory ("public_html") cannot easily be
# changed here, since it is a compile time setting. The apache package
# would have to be rebuilt. You could work around by deleting
# /usr/sbin/suexec, but then all scripts from the directories would be
# executed with the UID of the webserver.
#
# To rebuild apache with another setting you need to change the
# %userdir define in the spec file.

# not every user's directory should be visible:
UserDir disabled root

# to enable UserDir only for a certain set of users, use this instead:
#UserDir disabled
#UserDir enabled user1 user2


# the UserDir directive is actually used inside the virtual hosts, to
# have more control
UserDir public_html

<Directory /home/*/public_html>

AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>

<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
 
Old 10-15-2006, 02:40 AM   #5
Blindsight
Member
 
Registered: Mar 2003
Distribution: Slackware
Posts: 234

Rep: Reputation: 30
What does your httpd log tell you or your access.log? Is it trying to pull the file from the right place? what is your ls -l output in your public_html dir? [specifically your index.html] . Another question to ask: Are your home directories in /home?
 
Old 10-15-2006, 04:26 PM   #6
calculemus
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Blindsight
What does your httpd log tell you or your access.log? Is it trying to pull the file from the right place?
Here is access_log when I tailed it.
------------------------------------------------------------------------------------------------------------------------------------------
abacus:/var/log/apache2 # tail access_log
==============================
127.0.0.1 - - [15/Oct/2006:06:00:39 +0200] "GET / HTTP/1.1" 403 1015 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:00:46 +0200] "GET /~calculemus/ HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:01:18 +0200] "GET /~calculemus/abc.html HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:01:25 +0200] "GET /abc.html HTTP/1.1" 200 77 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:08:58 +0200] "GET /~calculemus/index.html HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:09:05 +0200] "GET / HTTP/1.1" 403 1015 "http://localhost/~calculemus/index.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:06:10:03 +0200] "GET /~calculemus/index.html HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:15:02:26 +0200] "GET /~calculemus/index.html HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:16:11:24 +0200] "GET /~calculemus/index.html HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"
127.0.0.1 - - [15/Oct/2006:23:11:01 +0200] "GET /~calculemus/ HTTP/1.1" 404 1011 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060911 SUSE/1.5.0.7-1.5 Firefox/1.5.0.7"

Quote:
Originally Posted by Blindsight
what is your ls -l output in your public_html dir? [specifically your index.html].
$>pwd
/home/calculemus/public_html
$> ls -l
-rwxr-xr-x 1 calculemus users 42 2006-10-13 03:32 index.html

Quote:
Originally Posted by Blindsight
Another question to ask: Are your home directories in /home?
Yep. All my directories are indeed in home.


One more thing... Last time I set up apache, it was apache 2 on SuSE linux 10.0 using YaST, I did not have to edit configuration files at all. Could it be possible that I have to tweak /etc/apache2/vhost.conf file a bit to get my localhost up and running?

Thanks for the replies. (y)
 
Old 10-22-2006, 10:52 PM   #7
calculemus
LQ Newbie
 
Registered: Sep 2006
Distribution: SuSE
Posts: 17

Original Poster
Rep: Reputation: 0
I found the solution. For some strange reason, Include /etc/apache2/mod_userdir.conf does not work when we put it inside /etc/apache2/httpd.conf but works well when we put it in /etc/apache2/default-server.conf file.

The solution:

* Add the following to /etc/apache2/default-server.conf file

<IfModule mod_userdir.c>
# The actual configuration of the directory is in
# /etc/apache2/mod_userdir.conf.
Include /etc/apache2/mod_userdir.conf
</IfModule>

* After editing the file, restart apache with # /etc/init.d/apache2 restart.

Last edited by calculemus; 10-22-2006 at 10:55 PM.
 
  


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
Samba configuration error when accessing NTFS files " Network path not found" leo_ieo Linux - General 2 10-09-2006 08:55 PM
GNU R help with converting SPSS file - object not found towsonu2003 Linux - Software 2 03-04-2006 11:30 AM
Samba problem with accessing localhost:901 rcj2 Linux - Networking 27 11-28-2005 07:50 PM
JSP context object not found poeta_boy Programming 1 09-21-2005 01:06 PM
cgi-bin (object not found, access forbidden) orish Linux - Newbie 3 05-24-2004 03:57 PM

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

All times are GMT -5. The time now is 03:22 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