1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Apache SETUP

Discussion in 'Apache' started by samscott, Aug 3, 2005.

  1. #1
    ok i can connect to my server through the internet .. but .. for some reason its giving me a 404 error ...


    here is my file ...



    can anyone see a problem with this ?? I think its something wrong with DocumentRoot Syntax .. not sure tho .. I am running Debian 3.1 ( sarge ) .. and apache 2.0


    thanks
     
    samscott, Aug 3, 2005 IP
  2. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #2
    we need more details :)

    but I think you need to write the ServerName out.
    samsbox.domain.com or something like that

    the 404 (give the complete response + error_log lines) is probably not from the VirtualHost but from the default server at that IP Address as 'samsbox' is not recognized
     
    frankm, Aug 3, 2005 IP
  3. samscott

    samscott Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok the error log states ..

    [error] [client 141.152.218.109] FileDoes not exist : /htdocs

    thats the log output when i go to samslinuxbox.ath.cx

    .. I changes ServerName ... to samslinuxbox.ath.cx .. didnt help ..

    also i bettter add that my router is blocking port 80 .. so I made apache listen on 81 .. so the acual url is ... http://samslinuxbox.ath.cx:81/


    thanks again
     
    samscott, Aug 3, 2005 IP
  4. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Check your error log:

    tail -n 25 /usr/local/apache2/logs/error_log

    Another thing - ServerName must be fully-qualified domain name, including the optional port (e.g. ServerName samslinuxbox.ath.cx:81)

    J.D.
     
    J.D., Aug 3, 2005 IP
  5. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #5
    Also, what is the name of your index files?

    Not sure what is configured out of the box, but you may want to check the line in your httpd conf file like this:

     DirectoryIndex index.html
    PHP:
    To make sure that it includes the name of your index file.

    i.e.
    
     DirectoryIndex index.html index.htm index.php
    
    PHP:
     
    nevetS, Aug 3, 2005 IP
  6. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #6
    look higher up in your config file. I am more of a fan of the apache 1.3 branch, soI'm not sure where 2.0 is different, but look up above there is a directory setting that its using instead of your virtualhost setting...

    Here is the setting in the 1.3 conf file

    DocumentRoot /usr/local/apache/htdocs

    Change the setting there instead of your virtual host to see if that solves the problem
     
    UndiesHosting, Aug 3, 2005 IP
  7. samscott

    samscott Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok ... in responce to J.D --- the command
    #tail -n 25 /usr/local/apache2/logs/error_log
    echos back "no such file or directory"
    Also i changes ServerName to samslinuxbox.ath.cx:81 --- not helping

    in responce to nevetS ... httpd is pretty empty .. and infact the readme specifies it as empty .. but i added that line and it didnt help

    in responce to UndiesHosting ... 2.0 is alot different than 1.3 ... there is no line that specifies a documentroot in the main cfg file ( apache2.cfg )

    Thanks again everyone .. keep the responces coming
     
    samscott, Aug 3, 2005 IP
  8. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #8
    More info on the directory index configuration directive:

    http://httpd.apache.org/docs/2.0/mod/mod_dir.html

    Your httpd.conf file SHOULD NOT be anywhere close to empty. It's a big giant text file required to make anything work. The filename may be different based on compile time directives (may be httpd.cfg on windows or something like that). The DirectoryIndex command can be used in your VirtualHost directive as well.

    Also, you really need to find your error log.

    find / -name error_log
    or
    locate error_log if you have locate installed, it's faster.
    might help you out. Also, this should be listed in your httpd.conf file if you do a search for ErrorLog

    In that file you will find the key to your problem.
     
    nevetS, Aug 3, 2005 IP
  9. samscott

    samscott Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    ok here are my config files i have and what the readme says about them ..
    apache2.conf -- this is the main config file
    conf.d/ ( directory ) -- Files in this DIR are included by this line in apache2.conf . This is a good place to add additional configuration directives
    httpd.conf --- README SAYS THIS " Empty File "
    site-available/sites-enabled -- this is where the virtualhost files are .
    ports.conf --- i set the listen port to 81

    thats all ...

    The log is in /var/log/apache2/ its called error.log .. is this the log i need ..

    i opened it up and read what the log writes when i get the 404

    - [Thu Aug 04 04:28:38 2005] [error] [client 141.152.218.109] File does not exist : /htdocs

    Thanks again ...

    keep it coming


    EDIT ___ -- I found DirectoryIndex .. it was in the apache.conf .. and it includes index.html which is correct ..
     
    samscott, Aug 3, 2005 IP
  10. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #10
    
    [Thu Aug 04 04:28:38 2005] [error] [client 141.152.218.109] File does not exist : /htdocs
    
    PHP:
    that looks to me like your web server is looking for /htdocs instead of /srv/www/samsbox

    OK... here's a direction that would be a little more difficult to research...
    The apache configuration file is linear - meaning if you have more than one site that meets the criteria, the first one in the file will get returned.

    It could be that you have two sites configured accidentally.

    does /htdocs exist? If not, create it and change ownership to your apache user. (i.e. mkdir /htdocs; chown nobody:nofiles /htdocs)

    Then copy your index file to /htdocs
    (cp /srv/www/samsbox/index.html /htdocs/index.html)

    Then check to see if the page loads. If that's the case, at least you know the source of your configuration problem.

    alternatively, search through your config files for "/htdocs" and analyze the settings to figure out if you need to comment out the line, update the line, or whatever. Changes to your config file will not take place until you restart apache. (usually /usr/local/apache/bin/apachectl configtest followed by /usr/local/apache/bin/apachectl restart)

    From your directory setup, it looks like you installed an RPM that was probably distributed with your OS. Or maybe you are using something like Plesk/CPanel/etc. The changed directories, file names, and file locations kind of throw us compiled-from-source people off because the commands I know off the top of my head are invalid for you. If you installed from RPM, I hate to say it, but you are probably better off contacting RH or whoever support or the debian/apache mailing list.

    Not to say I won't keep trying a little, it's just that since you don't know where your files are/what they are named and since I don't know where your files are/what they are named it makes things a lot more difficult for us to communicate.
     
    nevetS, Aug 4, 2005 IP
  11. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #11
    Regardless of the differences between a 2.0 and 1.3 config file, the trick is to always start with the error log and work backwards.

    If it says /htdocs file/directory is missing, then that's where apache is looking for the files requested. Like NevetS suggested, copy the files there and see if they display. Alternatively you can grep for htdocs and see where and how many times it shows up in the config file(s)

    Change it to what you want and you should be good to go...
     
    UndiesHosting, Aug 4, 2005 IP