Ubuntu Server 17.04 - 403 Forbidden

5,190

You might want to change these:

  1. chmod 775 -R /var/www/html

  2. chown www-data:www-data -R /var/www/html

  3. add this:AllowOverride all Order allow,deny allow from all

tell me if any worked for you.

Share:
5,190

Related videos on Youtube

Gianni
Author by

Gianni

Passionate Developer and enthusiast in System Administration, discovered the beauty of Server and Maintance. The only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle.

Updated on September 18, 2022

Comments

  • Gianni
    Gianni over 1 year

    Have Instlled for my Server all needed Services as:

    • OpenSSH Server
    • PHP7.1
    • MySQL
    • phpMyAdmin
    • Apache Tomcat8
    • FTP (vsftpd)

    but got still 403 Forbidden on Browser when trying to open a simple index.php file.

    using 000-default.conf, configured the apache2.conf as well apache2 ports.conf. Portwardfowrding on router looks like working fine. checked Permissions with chmod as well on www-dataand on User, but I'm stuck in 403 Forbidden.
    I've already checkd tons of forums, and reading a lot about, but couldn't find my solution, anyone has some good hints out there?

    =========================== Configuration - Update ===========================

    I keept everything prrety simple after installtion, quite everything is by default, expection to some configurations:
    sudo nano /etc/apache2/ports.conf

    Listen 192.168.1.104:82
    
    <IfModule ssl_module>
        Listen 82
    </IfModule>
    
    <IfModule mod_gnutls.c>
        Listen 82
    </IfModule>
    

    sudo nano /etc/apache2/sites-enabled/000-default.conf

    <VirtualHost 192.168.1.104:82>
    
        ServerAdmin [email protected]
        DocumentRoot /var/www/html
    
         <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
    
            <Directory /var/www/html>
                  #  Options Indexes FollowSymLinks MultiViews
                  #  AllowOverride None
            Require all granted
            </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    sudo nano /etc/nginx/sites-enabled/default

    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            root /var/www/html;
    
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.php index.nginx-debian.html;
    
            server_name _;
    
            location / {
                    try_files $uri $uri/ =404;
            }
    }  
    

    =========================== Update 2 ===========================

    Finally the 403 Forbidden could be partly solved with a
    chmod -R 755 /var/www/html Still no access as desired. Now Site can't be reached but downloads diretly the index file once entering in browser. So issue still not solved.

    • Luis Alvarado
      Luis Alvarado about 7 years
      Could you please post the changes you did each configuration file and how did you install each of the services. This way we have an idea on how to proceed.
    • Gianni
      Gianni about 7 years
      @LuisAlvarado: check edit on main Post, what do you think?
    • Luis Alvarado
      Luis Alvarado about 7 years
      Beautiful work. That will help a lot. Thank you.
    • Alok Yadav
      Alok Yadav about 7 years
      It looks like you are using nginx to serve PHP .. if yes then where is PHP block .
    • Alok Yadav
      Alok Yadav about 7 years
    • Gianni
      Gianni about 7 years
      @LuisAlvarado ;)
    • Gianni
      Gianni about 7 years
      @AlokYadav: the answer your've provided is unfortunately not the solution for this case. Already read this post to get inspired by the simple things of life, I suppose the issue is pretty tricky! ;)
    • pa4080
      pa4080 about 7 years
      Try to change <VirtualHost 192.168.1.104:82> with <VirtualHost *:82>, I'm almost sure this will help. Also in ports.conf, I think that, you don't need IP there, just Listen 82 and change next two ports to 83 - HTTP and HTTPS can't use the same port simultaneously.
  • Thomas Ward
    Thomas Ward about 7 years
    Comments are not for extended discussion; this conversation has been moved to chat.