Dowloadable Zip file, Apache 2.4, Forbidden

Discussion in 'Apache' started by roobdoob, Apr 24, 2019.

  1. #1
    I have a .zip file I would like to share. I am having problems with the permissions though. I have the .zip file on CentOs7 running Apache2.4.

    ---> zip file is located in /var/www/html/xxxsite1/Files/Xx.zip
    ---> index.html file located in /var/www/html/xxxsite1

    <a href="/Files/Xx.zip">Download</a>

    When clicking to Download link I get a forbidden 403.
    You don't have permission to access /Files/Xx.Zip on this server.

    File Permissions 755 ----> /Files/Xx.zip


    virtualhosts.conf file

    <VirtualHost *:80>
       DocumentRoot "/var/www/html/xxxsite1"
       ServerName wwx.xxxsite1.xxx
       ServerAlias xxxsite1.com
       ErrorLog /var/log/httpd/Error.log
       CustomLog /var/log/httpd/.log combined
    </VirtualHost>
    
    <VirtualHost *:80>
       DocumentRoot "/var/www/html/xxxsite2"
       ServerName wwx.xxxsite2.xxx
       ServerAlias xxxsite2.com
    </VirtualHost>
    Code (markup):
    What am I missing here?
    Thanks
     
    roobdoob, Apr 24, 2019 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    This can be caused by SELinux. Try to change the owner of the file in question to the Apache user:
    chown apache:apache /var/www/html/xxxsite1/Files/Xx.zip
    Code (markup):
     
    RoseHosting, Apr 26, 2019 IP
  3. hostechsupport

    hostechsupport Well-Known Member

    Messages:
    413
    Likes Received:
    23
    Best Answers:
    7
    Trophy Points:
    138
    #3
    Just change the ownership of the file to web server user.
     
    hostechsupport, Apr 30, 2019 IP