Forbidden when trying download file

November 8, 2014 1.6k views

I have a directory which contains files. I can access that directory (domain.com/xxx) but I cannot download files in (domain.com/xxx/file.ex). When I click on the file, appear the message "403 Forbidden. You do not have permission to access this server /xxx/file.ex". It also occurs on the main site.

Is there something wrong with the apache settings? But its fresh install.

1 comment
  • Hi! Can check if there are any errors in Apache's error log?

    sudo tail /var/log/apache2/error.log
    

    Also -- please post the output of the following command:

    stat /var/www/xxx/file.ex
    

    Make sure you replace /var/www with your DocumentRoot if that's not it.

2 Answers

tail /usr/local/apps/apache/logs/error_log

[Sat Nov 08 06:43:39 2014] [warn] Init: (domain.com:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Sat Nov 08 06:43:39 2014] [notice] SIGHUP received. Attempting to restart
[Sat Nov 08 06:43:39 2014] [notice] Digest: generating secret for digest authentication ...
[Sat Nov 08 06:43:39 2014] [notice] Digest: done
[Sat Nov 08 06:43:39 2014] [notice] Apache/2.2.29 (Unix) DAV/2 mod_ssl/2.2.29 OpenSSL/1.0.1j configured -- resuming normal operations
[Sat Nov 08 06:43:38 2014] [warn] Init: (domain.com:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Sat Nov 08 06:43:38 2014] [notice] SIGHUP received. Attempting to restart
[Sat Nov 08 06:43:38 2014] [notice] Digest: generating secret for digest authentication ...
[Sat Nov 08 06:43:38 2014] [notice] Digest: done
[Sat Nov 08 06:43:38 2014] [notice] Apache/2.2.29 (Unix) DAV/2 mod_ssl/2.2.29 OpenSSL/1.0.1j configured -- resuming normal operations
[Sat Nov 08 06:43:21 2014] [warn] Init: (domain.com:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Sat Nov 08 06:43:21 2014] [warn] Init: (domain.com:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Sat Nov 08 06:43:21 2014] [notice] Digest: generating secret for digest authentication ...
[Sat Nov 08 06:43:21 2014] [notice] Digest: done
[Sat Nov 08 06:43:21 2014] [notice] Apache/2.2.29 (Unix) DAV/2 mod_ssl/2.2.29 OpenSSL/1.0.1j configured -- resuming normal operations

tail /home/user/www/xxx/file.ex

File: 'file.ex'
Size: 102762578 Blocks: 200712. IO Block: 4096 regular file
Device: a030b621h/2687546913d Inode: 5248063 Links: 1
Access: (0600/-r-w-------) Uid: ( 1000/user) Gid: ( 1000/user)
Access: 2014-10-31 06:05:41.426000000 -0400
Modify: 2014-10-31 06:05:41.426000000 -0400
Change: 2014-11-08 10:10:21.748126663 -0500
Birth: -

  • Problem solved!
    Apparently one of the main script that I installed, automatically change the chmod all files to be (0600/-rw-------).
    I've remove it and chmod doesn't change automatically.

Have another answer? Share your knowledge.