Laravel Ubuntu 16.04 returning status code 500 - apache

I just deployed a Laravel project I developed at localhost (using XAMPP) to a server.
I uploaded all files, created a new .env file (also got an app-key), ran composer install, created the db, ran artisan migrate.
Also, in
/etc/apache2/sites-enabled/000-default.conf I set the DocumentRoot to the public directory of laravel. Also I tried to edit the apache2.conf to include the directory, with Allowoverride All.
But entering the ip of my server, I get redirect to the login page (of course, I'm using the Auth of Laravel).
But I'm getting the error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
I tried to follow those steps, but it's all the same. Except the one point, that in my apache2.conf I don't wrote the DocumentRoot anymore, as I already set it in the 000-default.conf. I also tried to set it a second time in the apache2.conf, but this changed nothing.
So what couuld the problem be?
I'm using Ubuntu 16.04.
PS: Something seems to happen inside of laravel. When I go an existing route, I always get this error code 500. When I go to a route, that doesn't exist, I get an error (NotFoundHttpException), so the Routing itself kinda seems to work, but where does this error come from? It are exactly the local files I'm using with XAMPP, and locally it works fine... Any ideas?
EDIT: After editing my logs directory to have permissions like 777, I'm getting 2 errors as well.
Both point to storage/framework/views/ and storage/framework/sessions, saying "Permission denied". Do I just have to run chmod for those directories as well?

Check the error in storage/logs/laravel.log if there is no log there then make sure your directory permissions for storage allows it to be writeable 775 is what I normally use.

Okay, I got it, basically it was the permissions.
I now changed the owner of the storage folder to www-data. Now it's working (for anyone that might experience this problem, too).

if you use vps ubuntu, you have to set write/read permission with root folder (and all file, folder of it) by using this command on putty:
chown -R www-data:www-data /var/www/html
i tried this command, and my website doest not show 500 error

Related

file not found error on apache in selinux

I had a working client to server connection going, where my javascript ajax -> apache server on selinux worked fine.
I copied over new versions of existing php files and overwrote the old ones using sudo.
I started getting 404 errors on my requests, even thought I can see the php file executing and returning the requested information to the ajax error function, but its hidden in the responseJSON - the status="error" and the error"404 not found"
I reset the ownership and permissions using
chown -R apache.apache /var/www/html/public/*
chcon -t httpd_sys_content_t /var/www/html/public/* -R
chcon -t httpd_sys_rw_content_t /var/www/html/public/data/* -R
The php file being queried is in /var/www/html/public/ and does not need to read or write to the directory (it does make SQL calls to and AWS database though).
It has permissions of:
-rw-r--r--. apache apache unconfined_u:object_r:httpd_sys_content_t:s0
I did not change apache config files, and the code was working before. The method in the code definitely exists, I can add error_log statements anywhere in the php code and they execute. Again, I do get the correct data, its just hidden and the overall response is a 404 error.
I also tried re-starting apache & clearing my java cache and restarting my client.
I'm looking for anything else I can try.
Thanks for any help

Unable to get access to specific directory to run a site on ec2

Still fairly new to ec2, I made a new directory as /home/user/www. Opened ftp service that allows git commits to be pushed to the server. This works fine as I can see the files come up. The problem being when I run my site, the Apache test page pops up and when I try opening a page in /home/user/www directory, it says Forbidden, you don't have permission to access / on this server.
I have successfully changed the DocumentRoot
DocumentRoot "/home/user/www"
AllowOverride None
# Allow open access:
Require all granted
and Directory in httpd.config to /home/user/www, all but to no result.
Any help is appreciated. Permissions are 777 for test basis but still no success. User is the owner of all the files in www
Solved my own question. Permissions need to be set on the third directory i.e., www. Therefore, I did chmod 755 ~/www.
Worked like a charm

how can I mount localhost for GlusterFs?

I have two nodes for GlusterFS and mount on /var/www/, everything works fine about GlusterFS, but when I run firefox for Localhost this error appears:
Forbidden. You don't have permission to access / on this server.
What should I do?
First, check file permissions for /var/www/ and subfolders. Make sure that the webserver is able to read those files.

how to configure apache to run pages with a different group id than files

I have a vps with godaddy with the following:
centos 6
latest apache
whm/cpanel
I am running with suphp enabled.
files and folders are all 755,644
i have a program located at:
/home/programname/public_html
this program edits files located on the same server in different user accounts. in order for this to happen i have to:
chown programname:programname /home/username/public_html
this allows the files to be edited by the program running at /home/programname/public_html
when i try to view the files at
/home/username/public_html
at its domain name
username.com
I get an "The server encountered an internal error or misconfiguration and was unable to complete your request."
in order to fix this i have to
chown username:username /home/username/public_html
how do i fix this so i can view the website files without having to chown the files?
You can use ACLs:
Enable ACLs on a filesystem:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-acls.html
Set ACLs on a filesystem:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/acls-setting.html
There is also an apache module that I haven't had much luck with:
apache2-mpm-itk - http://www.webtatic.com/packages/httpd-itk/
It has some issues because it doesn't support prefork properly.

Apache not allowing access to sub directories

I installed Apache2, php, and mysql onto my Linux Mint machine with the hopes of continuing a website I had built. After copy and pasting all of the code I had I noticed a problem with one of my include statments:
<?php include("./dir/file1.html");
That wasn't working. Originally I thought the issue was with php but after a lot of trial and error I've concluded it's apache not allowing access to subdirectories in the /var/www/ directory.
Since I'm new to editing apache configuration files, I'm not really sure what to change to allow access to all subdirectories within /var/www/ on localhost. I've tried adding:
<Directory /var/www/*>
order allow,deny
allow from all
</Directory>
to my httpd.conf file (which was blank, which I learned had something to do with Linux Mint being Debian based) and confirmed that default in /sites-available had similar code. I'll post that if it's requested.
I'm unsure on what else I can do to get apache to allow access to subdirectories in my /var/www/ directory for localhost and none of my previous methods have worked.
UPDATE:
I believe it's an Apache issue because when trying to go to a subdirectory through the browser (like localhost/dir/), I get a 403 error. I don't have to be going to an actual webpage for that problem. Also, include statments including files in the current directory has no problem, only with subdirectories.
The Include statement above gives no errors or any other useful messages. Whatever the include statement is including is just not there. I've tried require but that gives me a 500 server error: the server may be down for maintenance (paraphrased).