Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Problem installing apache webserver: “You don't have permission to access this resour

  1. #1
    Join Date
    Nov 2019
    Beans
    7

    Problem installing apache webserver: “You don't have permission to access this resour

    When I go in my browser to http://localhost, I get this:

    Forbidden

    You don't have permission to access this resource.

    Apache/2.4.29 (Ubuntu) Server at localhost Port 80


    I installed a new version of Ubuntu on my computer. Ubuntu 18.04.3 LTS



    The files for my website are on another disk. See program tools → disks
    Device: dev/sdb1
    Partition type: Linux Contence: Ext4(versie 1.0) – Mounted on /media/joris/doc


    I did following:

    source: https://tutorials.ubuntu.com/tutoria...igure-apache#1




    sudo apt update
    sudo apt install apache2
    cd /etc/apache2/sites-available/
    sudo cp 000-default.conf gci.conf


    sudo gedit gci.conf
    DocumentRoot media/joris/doc/website


    sudo a2ensite gci.conf
    service apache2 reload
    sudo adduser joris www-data
    sudo chown -R www-data:www-data /media/joris/doc/website
    sudo chmod -R g+rw /media/joris/doc/website




    P.S. I live in Belgium and I speak Dutch. Exist also a dutch forum
    of ubuntu?

  2. #2
    Join Date
    Feb 2010
    Location
    South of the Maple Trees
    Beans
    Hidden!
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: Problem installing apache webserver: “You don't have permission to access this re

    Moved to Server Platforms sub-forum.

  3. #3
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,779
    Distro
    Ubuntu Development Release

    Re: Problem installing apache webserver: “You don't have permission to access this re

    Hi,

    I just pointed you to an answer over on your askubuntu question.
    Now, I'll point you to an answer here: https://ubuntuforums.org/showthread....3#post13884703

    But also copy it below:

    If you want to use a non-stanadard directory, and in addition to all the permissions stuff, you have to tell apache to allow it via the /etc/apache2/apache2.conf file.
    Just copy the /var/www/html stantza stuff to whatever, example:

    Code:
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
    <Directory /media/newhd/test_web/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    Last edited by Doug S; November 20th, 2019 at 04:59 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  4. #4
    Join Date
    Nov 2019
    Beans
    7

    Re: Problem installing apache webserver: “You don't have permission to access this re

    My contence of etc/apache2/sites-available/gci.conf


    Code:
    <VirtualHost *:80>
         # The ServerName directive sets the request scheme, hostname and port that
         # the server uses to identify itself. This is used when creating
         # redirection URLs. In the context of virtual hosts, the ServerName
         # specifies what hostname must appear in the request's Host: header to
         # match this virtual host. For the default virtual host (this file) this
         # value is not decisive as it is used as a last resort host regardless.
         # However, you must set it for any further virtual host explicitly.
         #ServerName www.example.com
     
     
         ServerAdmin webmaster@localhost
         # DocumentRoot /var/www/html
         DocumentRoot /media/joris/doc/website
         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
         # error, crit, alert, emerg.
         # It is also possible to configure the loglevel for particular
         # modules, e.g.
         #LogLevel info ssl:warn
     
     
         ErrorLog ${APACHE_LOG_DIR}/error.log
         CustomLog ${APACHE_LOG_DIR}/access.log combined
     
     
         # For most configuration files from conf-available/, which are
         # enabled or disabled at a global level, it is possible to
         # include a line for only one particular virtual host. For example the
         # following line enables the CGI configuration for this host only
         # after it has been globally disabled with "a2disconf".
         #Include conf-available/serve-cgi-bin.conf
     </VirtualHost>






    Contence of:
    etc/apache2/apache2.conf
    first try: (I forgot to mention it in my first mail)

    Code:
     <Directory />
         Options FollowSymLinks
         AllowOverride None
         Require all denied
     </Directory>
     
     
     <Directory /usr/share>
         AllowOverride None
         Require all granted
     </Directory>
     
     
     #<Directory /var/www/>
     <Directory /media/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>




    Second try:
    Code:
     <Directory />
         Options FollowSymLinks
         AllowOverride None
         Require all denied
     </Directory>
     
     
     <Directory /usr/share>
         AllowOverride None
         Require all granted
     </Directory>
     
     
     <Directory /var/www/>
     Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>
     
     
     <Directory /media/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>

    Now I have the problem that my site is not shown! I get this:
    The default site of Apache!

    Apache2 Ubuntu Default Page


    It works!

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    14,737
    Distro
    Kubuntu 19.10 Eoan Ermine

    Re: Problem installing apache webserver: “You don't have permission to access this re

    If you want to point the server to non-standard directories, the easiest method to use an Alias directive. E.g.,

    Code:
    <VirtualHost *:80>
    [stuff]
    
    Alias /joris /media/joris/website
     
    <Directory /media/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
    </Directory>
    
    [stuff]
    </VirtualHost>
    Now, after restarting the server, the URL http://localhost/joris will use the /media/joris/website directory.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Nov 2019
    Beans
    7

    Re: Problem installing apache webserver: “You don't have permission to access this re

    My contence of etc/apache2/sites-available/gci.conf


    Code:
    <VirtualHost *:80>
         # The ServerName directive sets the request scheme, hostname and port that
         # the server uses to identify itself. This is used when creating
         # redirection URLs. In the context of virtual hosts, the ServerName
         # specifies what hostname must appear in the request's Host: header to
         # match this virtual host. For the default virtual host (this file) this
         # value is not decisive as it is used as a last resort host regardless.
         # However, you must set it for any further virtual host explicitly.
         #ServerName www.example.com
     
     
         ServerAdmin webmaster@localhost
         # DocumentRoot /var/www/html
         DocumentRoot /media/joris/doc/website
         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
         # error, crit, alert, emerg.
         # It is also possible to configure the loglevel for particular
         # modules, e.g.
         #LogLevel info ssl:warn
     
     
         ErrorLog ${APACHE_LOG_DIR}/error.log
         CustomLog ${APACHE_LOG_DIR}/access.log combined
     
     
         # For most configuration files from conf-available/, which are
         # enabled or disabled at a global level, it is possible to
         # include a line for only one particular virtual host. For example the
         # following line enables the CGI configuration for this host only
         # after it has been globally disabled with "a2disconf".
         #Include conf-available/serve-cgi-bin.conf
     </VirtualHost>






    Contence of:
    etc/apache2/apache2.conf
    first try: (I forgot to mention it in my first mail)

    Code:
     <Directory />
         Options FollowSymLinks
         AllowOverride None
         Require all denied
     </Directory>
     
     
     <Directory /usr/share>
         AllowOverride None
         Require all granted
     </Directory>
     
     
     #<Directory /var/www/>
     <Directory /media/doc/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>




    Second try:
    Code:
     <Directory />
         Options FollowSymLinks
         AllowOverride None
         Require all denied
     </Directory>
     
     
     <Directory /usr/share>
         AllowOverride None
         Require all granted
     </Directory>
     
     
     <Directory /var/www/>
     Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>
     
     
     <Directory /media/doc/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
     </Directory>

    Now I have the problem that my site is not shown! I get this:
    The default site of Apache!

    Apache2 Ubuntu Default Page


    It works!

  7. #7
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    18,830
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Problem installing apache webserver: “You don't have permission to access this re

    Code:
    DocumentRoot media/joris/doc/website
    uses a relative path. It must be an absolute path. Also, that directory needs to be open enough for the apache userid, www-data, to read.

    If the storage isn't using a Linux file system, then only storage mount options can control the needed permissions.

  8. #8
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    14,737
    Distro
    Kubuntu 19.10 Eoan Ermine

    Re: Problem installing apache webserver: “You don't have permission to access this re

    On Ubuntu/Debian you never need to edit the apache2.conf file. All your configurations should be in the .conf files in /etc/apache2/sites-available. Have you read this: https://help.ubuntu.com/lts/serverguide/httpd.html? Any Alias directives and associated <Directory> stanzas need to be inside a <VirtualHost> container in a file like gci.conf.
    Last edited by SeijiSensei; November 20th, 2019 at 05:51 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  9. #9
    Join Date
    Nov 2019
    Beans
    7

    Re: Problem installing apache webserver: “You don't have permission to access this re

    Quote Originally Posted by SeijiSensei View Post
    If you want to point the server to non-standard directories, the easiest method to use an Alias directive. E.g.,

    Code:
    <VirtualHost *:80>
    [stuff]
    
    Alias /joris /media/joris/website
     
    <Directory /media/joris/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
    </Directory>
    
    [stuff]
    </VirtualHost>
    Now, after restarting the server, the URL http://localhost/joris will use the /media/joris/website directory.
    I did this in /etc/apache2/sites-available/gci.conf
    Code:
    Alias /joris /media/joris/doc/website
     
    <Directory /media/joris/doc/website/>
         Options Indexes FollowSymLinks
         AllowOverride None
         Require all granted
    </Directory>

    But it doesn't work!

    http://localhost/joris give:

    Not Found

    The requested URL was not found on this server.


    Apache/2.4.29 (Ubuntu) Server at localhost Port 80

  10. #10
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,779
    Distro
    Ubuntu Development Release

    Re: Problem installing apache webserver: “You don't have permission to access this re

    Quote Originally Posted by SeijiSensei View Post
    On Ubuntu/Debian you never need to edit the apache2.conf file.
    That hasn't been my experience for non-standard directories, but I have always respected your posts herein. I don't have time right now, but I'll try it again on my test server when I do.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •