Help - Search - Members - Calendar
Full Version: Apache Config Problem
Linuxhelp > Support > Technical Support
Trebob
Im sort of new to Linux and am trying to get apache setup on my box. I am running Mandrake 8.1, and have apache 1.3.28 installed. The program itself installed, and I followed the guide that was on the site here. Thing is, I can get my server up and running (only if I am in a terminal as root though user and group are set to nobody), but when I point a browser to localhost I get a Forbidden Error. I have changed the permissions to the directory, and the files within to 644, so I would think it should be viewable, but nothing is.

I have tried typing in the filenames as well as the directories as well, but keep getting the same stuff.

Anyone have a clue what I can try?

Thanks in advance!
Joey
The directory should be 755 and the files inside 644.

Also check to see that you have an index.html file in the directory otherwise you will have to turn on "Indexes" in the httpd.conf file.

Here's an example of an entry with indexes

<Directory />
Options FollowSymLinks Includes Indexes
AllowOverride None
</Directory>
Trebob
The dir is now 755, and the files 644. There was an index.html present, but I made the include statement (used to be multiview). Still nada even with /loclahost/ and localhost/index.html.
Joey
Paste your httpd.conf file here so we can have a look. Also run ls -l on the directory so we can see the permissions.
Trebob
Here is the httpd.conf, I deleted almost all of the commented out lines, except for ones that looked like commands.
Thanks for looking.

ServerType standalone
ServerRoot "/usr/local/apache"
#LockFile /usr/local/apache/logs/httpd.lock

PidFile /usr/local/apache/logs/httpd.pid
ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard

#ResourceConfig /usr/local/apache/conf/srm.conf
#AccessConfig /usr/local/apache/conf/access.conf

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10

StartServers 5
MaxClients 150
MaxRequestsPerChild 0

#Listen 3000
#Listen 127.0.0.1:80
#BindAddress *
# LoadModule foo_module libexec/mod_foo.so
#ExtendedStatus On

Port 8080
User nobody
Group nobody


ServerAdmin Sorry
ServerName 127.0.0.1
DocumentRoot "/usr/local/apache/html"

<Directory />
Options FollowSymLinks Includes Indexes
AllowOverride None
</Directory>

<Directory "/usr/local/apache/html">
Options Indexes FollowSymLinks Includes Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
#<Directory /home/*/public_html>
# AllowOverride FileInfo AuthConfig Limit
# 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>
#</Directory>


<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>

AccessFileName .htaccess

<Files ~ "^.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>

#CacheNegotiatedDocs

UseCanonicalName On

<IfModule mod_mime.c>
TypesConfig /usr/local/apache/conf/mime.types
</IfModule>

DefaultType text/plain

<IfModule mod_mime_magic.c>
MIMEMagicFile /usr/local/apache/conf/magic
</IfModule>

HostnameLookups Off

ErrorLog /usr/local/apache/logs/error_log

LogLevel warn
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

CustomLog /usr/local/apache/logs/access_log common

#CustomLog /usr/local/apache/logs/referer_log referer
#CustomLog /usr/local/apache/logs/agent_log agent
#CustomLog /usr/local/apache/logs/access_log combined

ServerSignature On

# EBCDICConvertByType On=InOut text/* message/* multipart/*
# EBCDICConvertByType On=In application/x-www-form-urlencoded
# EBCDICConvertByType On=InOut application/postscript model/vrml
# EBCDICConvertByType Off=InOut */*

<IfModule mod_alias.c>

Alias /icons/ "/usr/local/apache/icons/"

<Directory "/usr/local/apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /manual/ "/usr/local/apache/html/manual/"

<Directory "/usr/local/apache/html/manual">
Options Indexes FollowSymlinks Includes Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
<Directory "/usr/local/apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

</IfModule>

<IfModule mod_autoindex.c>

IndexOptions FancyIndexing

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz

ReadmeName README
HeaderName HEADER

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

</IfModule>

<IfModule mod_mime.c>
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .sv
AddLanguage cs .cz .cs
AddLanguage ru .ru
AddLanguage zh-TW .zh-tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8


<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
</IfModule>

AddType application/x-tar .tgz

AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz

#AddType application/x-compress .Z
#AddType application/x-gzip .gz .tgz

# My own entry to include PHP
# I have tried starting without this line and it still failed.
AddType application/x-httpd-php .phtml .php

AddHandler cgi-script .cgi

AddType text/html .shtml
AddHandler server-parsed .shtml

#AddHandler send-as-is asis

#AddHandler imap-file map

#AddHandler type-map var

</IfModule>

#MetaDir .web

#MetaSuffix .meta

<IfModule mod_setenvif.c>

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4.0" force-response-1.0
BrowserMatch "Java/1.0" force-response-1.0
BrowserMatch "JDK/1.0" force-response-1.0

</IfModule>

#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .your-domain.com
#</Location>


#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .your-domain.com
#</Location>


#<Location /cgi-bin/phf*>
# Deny from all
# ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
#</Location>


#<IfModule mod_proxy.c>
# ProxyRequests On

# <Directory proxy:*>
# Order deny,allow
# Deny from all
# Allow from .your-domain.com
# </Directory>

# ProxyVia On

# CacheRoot "/usr/local/apache/proxy"
# CacheSize 5
# CacheGcInterval 4
# CacheMaxExpire 24
# CacheLastModifiedFactor 0.1
# CacheDefaultExpire 1
# NoCache a-domain.com another-domain.edu joes.garage-sale.com

#</IfModule>
# End of proxy directives.
Trebob
I am unable to copy the info from my term window. all the filles have permission 644 and look the same, but I will type one line out just as an example.

-rw-r--r-- 1 root root 33912 aug 22 15:54 httpd.conf
Joey
Hi,

You realize you have apache listening on 8080, when you are going to your site it should be http://localhost:8080

Can you paste the permissions of /usr/local/apache/html
Trebob
again still the inability to paste, but here goes..
-rw-r--r-- 1 root root 1456 aug 21 14:34 index.html
-rw-r--r-- 1 me me 1456 may 3 2001 index.html.en
Joey
Hi,

What is the permissions on the actual html directory though. Run ls -l /usr/local/apache/ and paste the contents.
Trebob
They are all:
drwxr-xr-x 2 root root 4096 aug 21 12:28 bin/
drwxr-xr-x 2 root root 4096 aug 21 12:28 cgi-bin/
drwxr-xr-x 2 root root 4096 aug 21 12:28 conf/
drwxr-xr-x 3 root root 4096 aug 21 12:28 html/
drwxr-xr-x 3 root root 4096 aug 21 12:28 icons/
drwxr-xr-x 3 root root 4096 aug 21 12:28 include/
drwxr-xr-x 2 root root 4096 aug 21 12:28 libexec/
drwxr-xr-x 2 root root 4096 aug 21 12:28 logs/
drwxr-xr-x 4 root root 4096 aug 21 12:28 man/
drwxr-xr-x 2 nobody nobody 4096 aug 21 12:28 proxy/
Trebob
I changed over the port to 80 instead of 8080, and that hasnt changed anything either :-/
Joey
Okay I think I found the problem:

<Directory "/usr/local/apache/html">
Options Indexes FollowSymLinks Includes Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Change this to:

<Directory "/usr/local/apache/html">
Options Indexes FollowSymLinks Includes Indexes
AllowOverride None
</Directory>

And then restart apache.

As well you should change the servername to localhost.

From the apache docs:

QUOTE
The ServerName directive sets the hostname of the server; this is used when creating redirection URLs. If it is not specified, then the server attempts to deduce it from its own IP address; however this may not work reliably, or may not return the preferred hostname. For example:

    ServerName www.example.com

would be used if the canonical (main) name of the actual machine were simple.example.com.




Edit: Actually you probably dont need the following in your config file since <Directory "/"> takes care of it. Give it a try though.

<Directory "/usr/local/apache/html">
Options Indexes FollowSymLinks Includes Indexes
AllowOverride None
</Directory>
Trebob
made the changes, and got the same thing. even tried changing the servername to the ip that the forbidden msg was giving me. same ol msg
Joey
Okay well something is really messed up because a default install of apache with minimal changes to the config files should work.

This following directive is normally used for htaccess (requiring a username/password to acess the directory).

CODE
<Directory "/usr/local/apache/html">
Options Indexes FollowSymLinks Includes Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>


Check your error log and access log to see what's going on.
Trebob
my access log is empty. i even stopped the server incase it was waiting to stop before storing info.

The error log had about 5 lines in it, that it took the mutex, caught the sigterm, and 2 lines about
Permission denyed: could not open transfer log file /usr/.../logs/access_log

i dont know what is going on.
Thanks for the super fast responces btw!
Joey
What are the permissions on the access_log file in /usr/local/apache/logs?

If you are running the server as nobody then nobody needs access to write to them.

Try:


CODE
chown root.nobody /usr/local/apache/logs/access_log


And

CODE
chmod 664 /usr/local/apache/logs/access_log
Trebob
changed it over, restarted the server and tried accessing the site a dozen times or so. still nothing in the file. are there any other files that i might have to change over to nobody as an owner?
Joey
What is your error_log reporting? Still the same problems accessing access_log?

What user is apache running as? Run this:

CODE
ps aux | grep apache


(The character between aux and grep is the pipe, normally located above the "Enter" or "Return" key on the keyboard)
Trebob
well, the error log isnt changing at the moment, its the exact same size.

the output of the processes is

apache 8502 0.0 0.9 6812 3664 ? S 17:05 0:00 httpd-perl -f /et (4 of these with differend pid's)
or the same thing but ending is
httpd -dperlproxi (and 5 of these)
Joey
Something odd is going on here.

In your conf file you have the following set:

QUOTE
User nobody
Group nobody


Yet apache is running on your system as user apache.

Try changing the conf file to
User apache
Group apache
Trebob
tried, restarted, and still no good.

I think I may need to invest in a more comfy chair cool.gif
Joey
I don't know what else to tell you. Apache works by default.

Trash the current install of apache and install the RPM version that comes with mandrake. It should work right out of the box that way.
Trebob
Thanks for all of your help!

what is the usual way of trashing an install?
(Im used to windows where there is registry stuff hidden everywhere, and wasnt sure if there was anything like that in linux)
Joey
You can try going into the apache source directory and running

CODE
make uninstall


If that doesnt work, kill apache and then remove /usr/local/apache
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.