problem with apache2 server on Linux

5,043

The problem you are seeing is that you have

Options none

configured for /srv/www/htdocs and the directory does not contain a valid index file as configured by DirectoryIndex.

Share:
5,043

Related videos on Youtube

Nickool
Author by

Nickool

Web Developer specializing in PHP, JavaScript, Ajax, JQuery and CSS3 with 3 years of experience creating and maintaining professional web applications. Experience developing technical specifications, documenting code and procedures. Effectively develop well structured, easily maintainable applications, web components, pages, style sheets.

Updated on September 18, 2022

Comments

  • Nickool
    Nickool over 1 year

    hello my server was running successful but I uninstall it and again I have installed it In YAST(Opensuse) as apache 2

    the out put of it is now:

    Access forbidden!

    You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
    
    If you think this is a server error, please contact the webmaster.
    Error 403
    localhost
    Fri Aug 5 21:19:30 2011
    Apache/2.2.10 (Linux/SUSE) 
    

    I changed the default-server.conf in /etc/apache2 and it wasn't successful and it was the reason that I uninstall and install it again

    I changed override None to override All and cause it wasn't successful I decide to delete changes by uninstall and installiation

    what can I do? I tried chmod 777 /srv/www/htdocs/myfile

    to set permission

    http://localhost

    is telling me with output: Itworks!

    Now then what is the problem?

    linux-llby:~ # cd /srv/www/htdocs/didebansnort/
    linux-llby:/srv/www/htdocs/didebansnort # ls -lha
    total 64K
    drwxr-xr-x 10 root root 4.0K Aug  6 19:22 .
    drwxrwxrwx  8 root root 4.0K Aug  6 19:21 ..
    drwxr-xr-x  2 root root 4.0K Aug  6 19:22 SQL
    -rwxr--r--  1 root root  15K Aug  6 19:22 adminuser.php
    drwxr-xr-x  9 root root 4.0K Aug  6 19:22 classes
    drwxr-xr-x  3 root root 4.0K Aug  6 19:22 config
    drwxr-xr-x  3 root root 4.0K Aug  6 19:21 core
    drwxr-xr-x  3 root root 4.0K Aug  6 19:22 docs
    drwxr-xr-x  3 root root 4.0K Aug  6 19:21 images
    -rwxr--r--  1 root root 3.1K Aug  6 19:21 index.php
    -rwxr--r--  1 root root 2.0K Aug  6 19:22 login.php
    drwxr-xr-x 10 root root 4.0K Aug  6 19:22 src
    drwxr-xr-x  9 root root 4.0K Aug  6 19:22 theme
    

    content of httpd.conf:

    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 index.php
    

    I changed the DirectoryIndex and insert the index.php too

    • user9517
      user9517 over 12 years
      Check your error log and post any relevant information as an edit to your answer and add the relevant portions of your server config.
    • Nickool
      Nickool over 12 years
      where is error log?
    • mailq
      mailq over 12 years
      You configured the error log location in the default-server.conf. If not, read the documentation.
    • Nickool
      Nickool over 12 years
      I have errors.conf did you mean it? well I changed default-server but I deleted the folder apache2 and again I installed it then what?would you please explain it?
    • Nickool
      Nickool over 12 years
      I mean after re installation the changes will be removed am i right?
    • Nickool
      Nickool over 12 years
      where is error_log I serached it in /etc it is not there
    • mailq
      mailq over 12 years
      IN your default-server.conf FILE there is a line like ErrorLog ${APACHE_LOG_DIR}/error.log. At that location is the error log.
    • Nickool
      Nickool over 12 years
      no such line I put the default-server.conf
    • Nickool
      Nickool over 12 years
      the thing that I changed and then again I uninstall it was the line override None that I changed it to override All but then when I tried vim /etc/apache2/default-server.conf in shell it wasn't successful and cause I didn't have knowledge to how to recover it I uninstall my apache and install it again
    • mailq
      mailq over 12 years
      Is it in httpd.conf then?
    • Nickool
      Nickool over 12 years
      I found the error log from what you said it is on /var/log/apache2/error_log
    • Nickool
      Nickool over 12 years
      I found it it is a huge file it has many lines that tell this one:[Fri Aug 05 21:24:37 2011] [error] [client ::1] Directory index forbidden by Options directive:
    • Nickool
      Nickool over 12 years
      directive:/srv/www/htdocs/didebansnort/ it is my file that I tried to browse it from browser
    • Nickool
      Nickool over 12 years
      I have index.html
    • gravyface
      gravyface over 12 years
      Can you cd to your /srv/www/htdocs/didebansnort/ and type in ls -lha and paste that in your question?
    • Nickool
      Nickool over 12 years
      ok I updated up there
    • Nickool
      Nickool over 12 years
      I am sure that it is not from index pages cause I changed something it is now has error but I uninstalled the whole just apache2 etc/sysconfig the apache2 didn't changed when I uninstalled it that I moved it to trash and again uninstall and install it but no reslult I am so confused that what i have done to cause this issue
    • Nickool
      Nickool over 12 years
      in past times successfuly I tried them and the index pages was the same it is my reason
    • Nickool
      Nickool over 12 years
      To the people here that votted me down I think it was a good issue to understand about permissions,httpd.conf,server-default.conf and specially the attribiutes and the usage of them.
  • Nickool
    Nickool over 12 years
    no it tells me it works! in bold font
  • Nickool
    Nickool over 12 years
    I have index.html in /srv/www/htdocs/didebansnort
  • Nickool
    Nickool over 12 years
    maliq I have this in didebansnort and in htdocs and the content is it works
  • Nickool
    Nickool over 12 years
    and have it in /srv/www/htdocs too
  • Nickool
    Nickool over 12 years
    Problem Solved! In options I changed it to options All Thank you lian!
  • Nickool
    Nickool over 12 years
    It is so strange I again set the options to None and again I deleted index.php and restart the apache! it is crazy! again it is working! it shows me index.php successfully I don't know why! it was a problem:-SSSSSssss
  • user9517
    user9517 over 12 years
    @Negin: Read about DirectoryIndex and then see what yours is set to - be amazed.
  • Nickool
    Nickool over 12 years
    @lain:you are right well I am so newbie in configuring my server I wanted to install Cake PHP and for some problem I change override I'll study it it take many times to me to understand the whole of it.I'm happy to solve this problem! I was too angry! I decided to format the whole and install my open suse again!! thanks God! that I understood!!!
  • HopelessN00b
    HopelessN00b over 11 years
    You're trolling, right? Please tell us you're just trolling.