Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

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

  1. #11
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

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

    Quote Originally Posted by jorisvh2 View Post
    I did this in /etc/apache2/sites-available/gci.conf

    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
    First, try using
    Code:
    Alias /joris/ /media/joris/website/
    Sometimes having both leading and trailing slashes works better.

    I'd also examine the log in /var/log/apache2 to see if they provide more detailed information.

    Did you restart Apache? Did you run "sudo a2ensite gci" to "activate" the site? Check in /etc/apache2/sites-enabled and make sure there is a symbolic link to /etc/apache2/sites-available/gci.conf.

    Earlier you suggested you had copied 000-default.conf to gci.conf. I'd delete or otherwise disable 000-default.conf. Apache parses these files in alphanumeric order which is why 000-default has the name it does.

    If none of that helps, I'd suggest moving the /etc/apache2 directory to /etc/apache2.old, then reinstalling apache2. Rename 000-default.conf to gci.conf if you like, but have just one instance of this configuration. Add the Alias directive and <Directory> stanza to that file and leave apache2.conf alone. Run a2ensite and restart apache2. Any better?

    Here, for example, is part of the configuration file for one of the virtual hosts on a server I manage:

    Code:
    <VirtualHost *:80>
        
    ServerName      www.example.com
    ServerAlias     example.com
    ServerAdmin     admin@example.com
    DocumentRoot    /var/www/html/wordpress
    ErrorLog        logs/error_log-example.com
    TransferLog     logs/access_log-example.com
    CustomLog       logs/referer_log-example.com "%h: %{referer}i -> %U"
    
    Alias /gallery/ /home/web/gallery/
    <Directory "/home/web/gallery">
        Options All
    </Directory>
    
    <Directory /var/www/html/wordpress>
    [etc.]
    </Directory>
    
    </VirtualHost>
    The site runs WordPress from /var/www/html/wordpress, but serves up files from /home/web/gallery/ when using the URI /gallery/.
    Last edited by SeijiSensei; November 20th, 2019 at 09:14 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

  2. #12
    Join Date
    Nov 2019
    Beans
    7

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

    I have taken new steps
    I encountered problems with rights in other programs




    mkdir /d
    sudo cp etc/fstab etc/fstab_oud


    sudo gedit etc/fstab
    # Harde schijf 1TB
    UUID="23f455e3-08a4-4e34-9122-19e375ed6a4c" /d ext4 defaults 0 0


    Folder website: /d/website


    cd etc/apache2/sites-available


    sudo gedit gci.conf
    # DocumentRoot /var/www/html
    DocumentRoot /d/website


    sudo gedit etc/apache2/apache2.conf
    <Directory /d/website/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    </Directory>


    With the program dolphin i added a named user www-data


    I have added named user www-data and
    [v] Apply changes to all subfolders and their content









    service apache2 reload


    My site is still not displayed, but the default site of apache!

  3. #13
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,690
    Distro
    Ubuntu 20.04 Focal Fossa

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

    Well, I see one glaring problem right off the bat (besides putting your site config edits in apache2.conf), when you created a folder, you failed to set the ownership and permissions.

    Whenever you do something like this:
    Code:
    sudo mkdir -p /d
    You need to follow it up with something like this:
    Code:
    sudo chown www-data:www-data /d
    sudo chmod 0755 /d
    Once you start placing files in there, you need to make sure ownership and permissions are being set correctly. It would behoove you to create a permission settings script and ensure it runs on a regular basis.

    Example (taken from my web tutorial):
    setperms.sh
    Code:
    #!/bin/bash
    #############################################
    ## Name          : setperms.sh
    ## Version       : 1.1
    ## Date          : 2019-09-03
    ## Author        : LHammonds
    ## Compatibility : Ubuntu Server 18.04 LTS
    ## Requirements  : Run as root user
    ## Purpose       : Ensures ownership and permissions are set correctly.
    ## Run Frequency : Manual as needed or via crontab schedule.
    ################ CHANGE LOG #################
    ## DATE       WHO WHAT WAS CHANGED
    ## ---------- --- ----------------------------
    ## 2019-07-23 LTH Created script.
    ## 2019-09-03 LTH Added full path to executables.
    #############################################
    wwwdir='/d'
    webuser='www-data'
    webgrp='www-data'
    rootuser='root'
    
    echo "Setting Ownership..."
    /bin/chown -R ${webuser}:${webgrp} ${wwwdir}/
    /bin/echo "Setting Folder Permissions..."
    /usr/bin/find ${wwwdir}/ -type d -print0 | /usr/bin/xargs -0 /bin/chmod 0750
    /bin/echo "Setting File Permissions..."
    /usr/bin/find ${wwwdir}/ -type f -print0 | /usr/bin/xargs -0 /bin/chmod 0640
    if [ -f ${wwwdir}/.htaccess ]; then
      /bin/chmod 0644 ${wwwdir}/.htaccess
    fi
    /bin/echo "Permission change complete."
    LHammonds

  4. #14
    Join Date
    Nov 2019
    Beans
    7

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

    I did this:
    sudo chown -R www-data:www-data /d/website
    sudo chmod -R 0755 /d/website

    My site is still not displayed!! I get this: See: http://pasteall.org/pic/show.php?id=...1b89145c01d5af
    Last edited by jorisvh2; November 21st, 2019 at 04:37 PM.

  5. #15
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

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

    As I said, if you have both 000-default.conf and gci.conf in the /sites-enabled/ directory, Apache will use the first of these. If you want it use gci.conf, use a2dissite or delete the symbolic link in /sites-enabled/.
    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. #16
    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
    As I said, if you have both 000-default.conf and gci.conf in the /sites-enabled/ directory, Apache will use the first of these. If you want it use gci.conf, use a2dissite or delete the symbolic link in /sites-enabled/.
    Indeed SeijiSensei!!

    i did this:
    joris@joris-MS-7798:/etc/apache2/sites-available$ sudo a2dissite 000-default
    [sudo] wachtwoord voor joris:
    Site 000-default disabled.
    To activate the new configuration, you need to run:
    systemctl reload apache2
    joris@joris-MS-7798:/etc/apache2/sites-available$ sudo a2ensite gci.conf
    Site gci already enabled
    joris@joris-MS-7798:/etc/apache2/sites-available$ sudo service apache2 reload

    and it worked!!! Thank you very much!!!

  7. #17
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,521
    Distro
    Ubuntu Development Release

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

    In earlier posts, I mentioned that access to non-standard directories also needed to specifically allow access via /etc/apache2/apache2.conf. That seems to be the case for my Ubuntu 16.04 test server. Without it I get:

    Code:
    [Sun Nov 24 15:42:28.330709 2019] [authz_core:debug] [pid 28871] mod_authz_core.c(809): [client 192.168.111.101:62206] AH01626: authorization result of Require all denied: denied
    [Sun Nov 24 15:42:28.330741 2019] [authz_core:debug] [pid 28871] mod_authz_core.c(809): [client 192.168.111.101:62206] AH01626: authorization result of <RequireAny>: denied
    [Sun Nov 24 15:42:28.330748 2019] [authz_core:error] [pid 28871] [client 192.168.111.101:62206] AH01630: client denied by server configuration: /media/vm/test_web/
    And with it I get:

    Code:
    [Sun Nov 24 15:51:53.260036 2019] [authz_core:debug] [pid 13148] mod_authz_core.c(809): [client 192.168.111.101:62259] AH01626: authorization result of Require all granted: granted
    [Sun Nov 24 15:51:53.260056 2019] [authz_core:debug] [pid 13148] mod_authz_core.c(809): [client 192.168.111.101:62259] AH01626: authorization result of <RequireAny>: granted
    Last edited by Doug S; November 25th, 2019 at 01:01 AM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

Page 2 of 2 FirstFirst 12

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
  •