I'm trying to view a webapp whose folder is in "/var/www/myapp", but Apache2 server sends me a HTTP/1.0 500 Internal Server Error.

I have an index, Htm, and a phpinfo() in "/var/www" and it works well.

  • show logs from your error_log – Mike May 17 '11 at 20:49

From what I gather from this question, you have some website where you can access:


and that renders a page, but when you try to access:


it sends a 500.

A 500 can mean a few things. One is that you might not have an index.htm or index.php file in your "myapp" folder, so Apache tries a request to render the folder itself and is disallowed from doing so (based on configuration or permission).

I'd make sure that there is an index file in myapp. If this is not the issue, then check the following command:

ls -lha /var/www


 ls -lha /var/www/myapp

This will list all the files and directories in your /var/www (and subsequently, /var/www/myapp) in a human readable format. For example, in /var/www you may have:

drwxr-xr-w  2 root root 4.0K Dec 12 02:24 .
drwxr-xr-w 14 root root 4.0K Nov 24 20:29 ..
-rw-r--r--  1 root root   76 Dec 12 02:25 index.html
drw-r-----  2 root root 4.0K Jan 14 01:14 myapp

(Note the filesizes/dates may be different, etc)

The 'root' in my example is the owner and the group. The stuff with the dashes, r,w,x are the permissions based on user/group/others. In my case, the web server can read everything but the myapp folder, because of permissions.

What may possibly be happening in your case, is that the user that is running your Apache may not have access to read the contents of myapp folder. One way to check this is to chown the files to the user that runs Apache (which I believe in Debian is defaulted to www-data) OR chmod the folder/files to the appropriate permission levels. A way to test to see if this is a permissions issue would be to set everything in your /var/www to chmod 777 (but note that you should not keep the permissions this way because of potential security concerns with other users of the server).

It is also important to check your error.log logs for the server running in /var/www.

| improve this answer | |
  • chmod 777: nonononono! Never ever run chmod 777. It is practically never required! Not even for "testing purposes". If the file is readable, then it's readable. If it's writable by the user or group that need to write to it, then it's writable. There is absolutely zero need to give everyone write permissions, and forgetting to chmod it back to something sane is exactly how multinationals get hacked. Just don't do it. Ever. I wrote an introduction of Unix permissions. Please read it! – Martin Tournoij Mar 13 '16 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.