cachethq / cachet

🚦 The open-source status page system.
https://cachethq.io
MIT License
13.99k stars 1.56k forks source link

HTTP 500 and Permission Denied errors on new Cachet 2.4 install #2621

Closed nickxj closed 7 years ago

nickxj commented 7 years ago

Hello Cachet developers! I'm receiving a HTTP 500 error when accessing the URL of a new install of Cachet 2.4.

[root]# wget http://localhost
--2017-07-06 20:30:59--  http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/setup [following]
--2017-07-06 20:31:00--  http://localhost/setup
Reusing existing connection to [localhost]:80.
HTTP request sent, awaiting response... 500 Internal Server Error
2017-07-06 20:31:00 ERROR 500: Internal Server Error.

Note: the output via wget is only for the benefit of showing the HTTP 302 redirect to /setup is occurring. I also test using Chrome from a remote host.

The contents of /var/log/httpd/error_log show errors attempting to open /var/www/Cachet/storage/logs/laravel-2017-07-05.log, however the apache user has full access to the directory. A full listing of the effective directory permissions is near the end of post.

My install -

Content of /etc/httpd/conf.d/cachet.conf

<VirtualHost *:80>
   ServerName server
   ServerAlias server
   DocumentRoot "/var/www/Cachet/public"
   <Directory "/var/www/Cachet/public">
     Require all granted
     Options Indexes FollowSymLinks
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>
</VirtualHost>

Content of /var/www/Cachet/.env

PP_ENV=production
APP_DEBUG=true
APP_URL=http://localhost
APP_KEY=base64:zcDji9zbQXiau7ga8tHcN5E5chmK8OUyG9EXvOIfhtI=

DB_DRIVER=mysql
DB_HOST=localhost
DB_UNIX_SOCKET=null
DB_DATABASE=cachet
DB_USERNAME=cachetuser
DB_PASSWORD=cachetuser_passwd
DB_PORT=null
DB_PREFIX=null

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

CACHET_BEACON=true
CACHET_EMOJI=false
CACHET_AUTO_TWITTER=true

MAIL_DRIVER=log
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ADDRESS=null
MAIL_NAME=null
MAIL_ENCRYPTION=tls

REDIS_HOST=null
REDIS_DATABASE=null
REDIS_PORT=null

GITHUB_TOKEN=null

NEXMO_KEY=null
NEXMO_SECRET=null
NEXMO_SMS_FROM=Cachet

Permissions

[root]# ls -l /var/www/
drwxr-xr-x. 12 apache apache 4096 Jul  6 16:25 Cachet
drwxr-xr-x.  2 root   root      6 Apr 12 21:04 cgi-bin
drwxr-xr-x.  2 root   root      6 Apr 12 21:04 html
[root]# ls -l /var/www/Cachet
drwxr-xr-x. 15 apache apache   4096 Jul  6 16:23 app
-rw-r--r--.  1 apache apache   1639 Jul  6 16:23 artisan
drwxrwxrwx.  4 apache apache     64 Jul  6 16:23 bootstrap
-rw-r--r--.  1 apache apache   3216 Jul  6 16:23 CODE_OF_CONDUCT.md
-rw-r--r--.  1 apache apache   3384 Jul  6 16:23 composer.json
-rw-r--r--.  1 apache apache 222177 Jul  6 16:23 composer.lock
drwxr-xr-x.  2 apache apache   4096 Jul  6 16:23 config
-rw-r--r--.  1 apache apache   2806 Jul  6 16:23 CONTRIBUTING.md
-rw-r--r--.  1 apache apache    240 Jul  6 16:23 crowdin.yaml
drwxr-xr-x.  6 apache apache     82 Jul  6 16:23 database
-rw-r--r--.  1 apache apache   1504 Jul  6 16:23 LICENSE
-rw-r--r--.  1 apache apache   1632 Jul  6 16:23 package.json
-rw-r--r--.  1 apache apache 290749 Jul  6 16:23 package-lock.json
-rw-r--r--.  1 apache apache   1584 Jul  6 16:23 phpunit.xml.dist
drwxr-xr-x.  5 apache apache   4096 Jul  6 16:27 public
-rw-r--r--.  1 apache apache   2535 Jul  6 16:23 README.md
drwxr-xr-x.  5 apache apache     42 Jul  6 16:23 resources
-rw-r--r--.  1 apache apache    405 Jul  6 16:23 server.php
drwxrwxrwx.  5 apache apache     60 Jul  6 16:23 storage
drwxr-xr-x.  8 apache apache   4096 Jul  6 16:23 tests
drwxr-xr-x. 38 apache apache   4096 Jul  6 16:25 vendor
-rw-r--r--.  1 apache apache     10 Jul  6 16:23 VERSION
-rw-r--r--.  1 apache apache   2132 Jul  6 16:23 webpack.mix.js
-rw-r--r--.  1 apache apache  98606 Jul  6 16:23 yarn.lock
[root]# ls -l /var/www/Cachet/storage
drwxrwxrwx. 2 apache apache 23 Jul  6 16:23 app
drwxrwxrwx. 5 apache apache 62 Jul  6 16:23 framework
drwxrwxrwx. 2 apache apache 23 Jul  6 16:23 logs

I've executed these commands as recommended by other posts and your documentation with no change in behavior -

[root]# chmod -R 777 /var/www/Cachet/storage/
[root]# chmod -R 777 /var/www/Cachet/bootstrap/
[root]# chown -R apache:apache /var/www/Cachet/
[root]# rm -rf /var/www/Cachet/bootstrap/cache/*
[root]# php artisan config:cache
[root]# php artisan key:generate
[root]# systemctl restart httpd

Thank you for your assistance!

nan008 commented 7 years ago

I don't know if you got around this error - if not:

I had similar problem running under Nginx - could not get the Cachet setup page, I gave 777 to /etc/Cachet/public (where my index.php is) and /etc/Cachet and it did not work. I solve it with giving 777 for /etc as well. Now for me Cachet 2.4 is working. Try it