LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-16-2004, 09:02 PM   #1
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Rep: Reputation: 15
apachei


i have changed my Document Root in the config files to a different location -- now everytime that i go to my site http://localhost i get a 403 Forbidden error:

Code:
Forbidden


You don't have permission to access / on this server.

Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) 
mod_perl/1.99_09 Perl/v5.8.1 mod_ssl/2.0.47 OpenSSL/0.9.7b 
PHP/4.3.2 Server at 127.0.0.1 Port 80Forbidden   
You don't have permission to access / on this server. 
Apache-AdvancedExtranetServer/2.0.47 (Mandrake Linux/6mdk) 
mod_perl/1.99_09 Perl/v5.8.1 mod_ssl/2.0.47 
OpenSSL/0.9.7b PHP/4.3.2 Server at 127.0.0.1 Port 80
What do i do?

Last edited by Patbuzz86; 05-16-2004 at 09:03 PM.
 
Old 05-16-2004, 09:37 PM   #2
edman007
Member
 
Registered: Sep 2003
Distribution: slackware-current
Posts: 173

Rep: Reputation: 30
is there an index.html or index.php or something like that in the new doc root, your server probably has directory listings off and there is no index page in the new folder you have it serve from, try putting a index.html file in there

if thats not it, then check the folder and see if the server has read permission of it
 
Old 05-16-2004, 09:46 PM   #3
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
1. It has an index.html file in it (http://localhost/index.html -- returns a 403 // so does http://localhost/something.html- which is a fake file

2. the ls -l out put of /var/www is

Code:
total 24
drwxr-xr-x    2 root     root         4096 Apr 20 15:30 cgi-bin/
drwxr-xr-x    3 root     root         4096 Apr 20 15:30 error/
drwxrwxrwx    3 root     root         4096 Apr 29 18:16 html/
drwxr-xr-x    3 root     root         4096 Apr 20 15:30 icons/
drwxr-xr-x    3 root     root         4096 Apr 20 15:30 perl/
drwxrwxrwx    2 root     root         4096 Apr 29 20:08 site/
here is the output of ls -l on the site directory which is what i wanted the document root changed to

Code:
total 4
-rw-rw-r--    1 patrick  patrick       169 Apr 29 20:08 index.html
 
Old 05-16-2004, 10:48 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
When you changed your document root, you have to be sure to change the path in the line that looks like this as well:

Code:
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/data/www/htdocs">
 
Old 05-17-2004, 06:40 AM   #5
PaulScott56
LQ Newbie
 
Registered: May 2004
Location: South Africa
Distribution: Mandrake
Posts: 8

Rep: Reputation: 0
I see that the document root is owned by root, although it has the correct permissions, apache won't be able to use it until you chown it to user apache (or nobody - check your apache config). so in the document root issue (as root) chown -vR apache * and that should fix it up!
 
Old 05-17-2004, 06:45 AM   #6
korozion
Member
 
Registered: Apr 2004
Location: Canada
Distribution: Debian
Posts: 124

Rep: Reputation: 15
You need to change apache2.conf as well as commonapache2.conf. I use find to look for localhost and deltete it. There may be a few references to localhost in other apache config files as well (php etc) Just check through them and delete the localhost entries

Last edited by korozion; 05-17-2004 at 06:46 AM.
 
Old 05-17-2004, 04:41 PM   #7
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
here is my httpd2.conf file

Code:
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/site


### Dynamic Shared Object (DSO) Support
### 
### You should always leave those three, as they are needed for 
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module	modules/mod_access.so
LoadModule auth_module		modules/mod_auth.so
LoadModule auth_anon_module	modules/mod_auth_anon.so
##LoadModule auth_dbm_module	modules/mod_auth_dbm.so
LoadModule auth_digest_module	modules/mod_auth_digest.so
##LoadModule charset_lite_module	modules/mod_charset_lite.so
##LoadModule case_filter_module	modules/mod_case_filter.so
##LoadModule case_filter_in_module	modules/mod_case_filter_in.so
##LoadModule ext_filter_module	modules/mod_ext_filter.so
LoadModule include_module	modules/mod_include.so
LoadModule log_config_module	modules/mod_log_config.so
##LoadModule logio_module		modules/mod_logio.so
LoadModule env_module		modules/mod_env.so
##LoadModule mime_magic_module	modules/mod_mime_magic.so
##LoadModule cern_meta_module	modules/mod_cern_meta.so
LoadModule expires_module	modules/mod_expires.so
LoadModule headers_module	modules/mod_headers.so
LoadModule usertrack_module	modules/mod_usertrack.so
##LoadModule unique_id_module	modules/mod_unique_id.so
LoadModule setenvif_module	modules/mod_setenvif.so
LoadModule mime_module		modules/mod_mime.so
LoadModule status_module	modules/mod_status.so
LoadModule autoindex_module	modules/mod_autoindex.so
LoadModule asis_module		modules/mod_asis.so
LoadModule info_module		modules/mod_info.so
LoadModule cgi_module		modules/mod_cgi.so
##LoadModule cgid_module		modules/mod_cgid.so
LoadModule vhost_alias_module	modules/mod_vhost_alias.so
LoadModule negotiation_module	modules/mod_negotiation.so
LoadModule dir_module		modules/mod_dir.so
LoadModule imap_module		modules/mod_imap.so
LoadModule actions_module	modules/mod_actions.so
##LoadModule speling_module	modules/mod_speling.so
LoadModule userdir_module	modules/mod_userdir.so
LoadModule alias_module		modules/mod_alias.so
LoadModule rewrite_module	modules/mod_rewrite.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In 
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
# For Apache2 we load all conf files in conf.d
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the 
# cgi or php files

#BindAddress *
<IfDefine APACHEPROXIED>
    Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
    Listen 80
</IfDefine>

# Likewise, we can set apache as the server by default and send perl
# requests via ProxyPass to apache-mod_perl. It increases performance
# since the perl interpreter is only used for perl and the standard apache
# does all the html and image files, with a smaller footprint.
#
# If you install apache and apache-mod_perl, this is the default config.
# If you don't want two web servers to use perl, uninstall apache, and
# apache-mod_perl will not be proxied.

<IfDefine PERLPROXIED>
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^proxy:.*  -  [F]
    RewriteRule ^(.*\/perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
    RewriteRule ^(.*\/cgi-perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
</IfModule>
</IfDefine>

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts 
###
# We include different templates for Virtual Hosting. Have a look in the 
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf


###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15


# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         150
MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>
 
Old 05-17-2004, 04:51 PM   #8
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
i dont know what to do
 
Old 05-17-2004, 05:36 PM   #9
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by korozion
You need to change apache2.conf as well as commonapache2.conf. I use find to look for localhost and deltete it. There may be a few references to localhost in other apache config files as well (php etc) Just check through them and delete the localhost entries
In the directions it says not to change that file (i did anyway and still go the same message)

Quote:
Originally posted by PaulScott56
I see that the document root is owned by root, although it has the correct permissions, apache won't be able to use it until you chown it to user apache (or nobody - check your apache config). so in the document root issue (as root) chown -vR apache * and that should fix it up!
I have done this and it still doesnt work
(oh and by the way i am shutting down and restartign the server everytime that i make a change so the changes will go into effect
Code:
/sbin/service httpd restart

Last edited by Patbuzz86; 05-17-2004 at 05:38 PM.
 
Old 05-17-2004, 07:25 PM   #10
korozion
Member
 
Registered: Apr 2004
Location: Canada
Distribution: Debian
Posts: 124

Rep: Reputation: 15
Did you also check Vhosts.conf? There are many config files located in conf/ check them all
 
Old 05-18-2004, 02:18 PM   #11
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
im not trying to set up a Vhost im trying to set up apache
 
Old 05-18-2004, 04:01 PM   #12
devinWhalen
Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Red Hat, openBSD,Mandrake,freeBSD,SunOS
Posts: 168

Rep: Reputation: 30
I tried doing just what you did and got the same problem. I don't think you can change the document root.. I don't know if you noticed or not but there is a comment just about where you changed the document root
Code:
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
So I would heed these words. Why do you want to change the document root anyhow? I don't know what your reasons are buy maybe using Alias would do what you are trying to achieve?

So unless you have good reason (I can't think of one) you might just want to leave it. I know this isn't much help but apache may have been designed to have /var/www/html as the root and that's that.

Later
 
Old 05-18-2004, 07:35 PM   #13
korozion
Member
 
Registered: Apr 2004
Location: Canada
Distribution: Debian
Posts: 124

Rep: Reputation: 15
I changed mine a month or so ago, so I'm pretty sure it's possible. Actually you are running two vhosts, one handles all connections, the other handels https connections (on port 443 by default) Plus notice that your apache2.conf calls vhosts.conf. As I said, there are many config files and all need to be edited. Just use a text editor with find and search for localhost in each and every config file. And I'm sure your problem with be fixed.
 
Old 05-18-2004, 08:04 PM   #14
Patbuzz86
Member
 
Registered: Mar 2004
Distribution: MDK 9.2
Posts: 92

Original Poster
Rep: Reputation: 15
but wheni opened up vhost.conf all of the script was commented(started with #) is this a problem?

Do i need to change the server root?! - i think that the server root is the path to the actual server program not the document root
 
Old 05-19-2004, 12:22 AM   #15
korozion
Member
 
Registered: Apr 2004
Location: Canada
Distribution: Debian
Posts: 124

Rep: Reputation: 15
Please, for the love of everything holy (Linux) Delete everything that says localhost in every config file
 
  


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



LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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