"Internal Server Error" when deploying Laravel app on VPS - php

I'm trying to deploy a Laravel 5.6 app on a Debian 9 based VPS with Apache, but the server seem to be unable to handle the requests when i try to access the first page,and i keep having
"Internal Server Error The server encountered an internal error or
misconfiguration and was unable to complete your request."
I've already looked at this
Laravel htaccess
Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
https://www.howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache/
My .htaccess file that i placed inside the public folder
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
The configuration file places inside /etc/apache/sites-available
<VirtualHost *:80>
ServerName picodem.dev
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/picodem-project/public
<Directory /var/www/html/picodem-project>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I don't have a domain name yet, and the picodem.dev is just dummy, so i'm accessing the app via the Browser using the IP address of the VPS, but i'm still not sure what's causing the problem...

Related

domain without www redirects to xampp dashboard

My domain originally had a www (https://www.my-domain.com) i changed it recently to redirect to non www.
Now when i go to my-domain.com on my browser, it goes to my localhost XAMPP dashboard (https://localhost/dashboard/). and when i turn xampp off, i get a "Unable to connect" on firefox.
I've tried the site on my mobile and my mac, it works fine and points to the server. I've also reinstall xampp on my PC, and still get the same result.
Not sure if this is the issue, but my current .htaccess is
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
and my virtual host on my ubuntu server is
<IfModule mod_ssl.c>
<VirtualHost *:433>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/frontend/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName my-domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.my-domain.com
SSLCertificateFile /etc/letsencrypt/live/my-domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my-domain.com/privkey.pem
</VirtualHost>
<Directory /var/www/html/frontend/www>
Options Indexes FollowSymLinks MultiViews
AllowOvereride All
Order allow,deny
allow from all
Require all granted
</Directory>
</IfModule>
Any idea what's going on?
My server is running ubuntu 18 on AWS.
The usual problem here is that you have no matching virtualhost set up to handle your new servername.
When that happens on a server, it "redirects" you to first matching virtualhost (which is probably xampp dashboard).
You have probably changed the application and it's .htaccess, but you didn't modify your virtualhost for the domain.
if you DID modify yourvirtualhost, please make sure to restart xampp, otherwise xampp won't consider changes made.

Centos 6 with WHM Server configuration for Akeneo

I am trying to configure Akeneo With WHM in Centos 6 Apache 2 server.
I am following this tutorials enter link description here
I configured this in ubuntu machine I got no error. The issue I found is with server and php.
When I launch my site I get this following error.
No input file specified.
My httd.conf file below:
<VirtualHost my-ip:80>
ServerName my-domain.co
ServerAlias mail.domain-group.co www.abs-group.co
DocumentRoot /home/user/public_html/pim-community-standard/web/
<Directory "/home/user/public_html/pim-community-standard/web">
AllowOverride None
Require all granted
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</Directory>
<Directory /home/user/public_html/pim-community-standard>
Options FollowSymlinks
</Directory>
<Directory /home/user/public_html/pim-community-standard/web/bundles>
RewriteEngine Off
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/opt/cpanel/ea-php71/root/usr/var/run/php-fpm/897e2bef0970b20f1bbeeae9d7c0de8ba9c47453.sock|fcgi://my-domain.co/"
</FilesMatch>
ServerAdmin webmaster#user-group.co
UseCanonicalName Off
</VirtualHost>
I get the following error in my apache error log.
AH01071: Got error 'Unable to open primary script: /home/user/public_html/pim-community-standard/web/app.php (No such file or directory)\n'
I am struggling with this error for past 2days. Please help me.

XAMPP Access Forbidden

I have just downloaded the latest version of XAMPP with PHP version 7.2.4. I have made a very simple PHP validation for a HTML form and when I press submit it comes up with the following:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4
I'd don't know what the problem is as I have tried changing Require none to Require all granted.
Please Help!
I have experienced this problem and found out that localhost link is not configured in
httpd_vhosts.conf.
So I added this line at the bottom part of httpd_vhosts.conf
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs"
ServerName localhost
</VirtualHost>
Well, probably this must be happening because the localhost link is not configured in your xamp vhost, try to look for the vhosts configuration file and add the same one there. Just add this block of code making the appropriate path changes until your repository so that you can access the localhost:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#hcode.com.br
DocumentRoot "C:\ecommerce"
ServerName www.hcodecommerce.com.br
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
<Directory "C:\ecommerce">
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</Directory>
</VirtualHost>
By default in httpd.conf your entire system directory "/" is secured and not allowed access
in httpd.conf:
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
Add the below additional under the above
<Directory /home>
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
Change /home to your hosted installation public directory - e.g. /projects or /devsite.local etc...
For more info on Apache see here: https://httpd.apache.org/docs/current/mod/core.html#directory
The 'Options' are typical .htaccess directives - change as needed
The 'AllowOverride All' gives access to the /home folder and everything under it
The 'Require local' makes sure only localhost / 127.0.0.1 has access to folder and files under /home
Hope this helps :D

Deploy a lumen project in AWS ec2 with multiple Virtual Host

I need to deploy three site in AWS ec2 ubuntu server (same ip),
html(default site)
aaa.com(www.aaa.com)
bbb.com(www.bbb.com)
/var/www:
html
public
index.html
aaa.com
public_html
index.html
bbb.com
public_html
app
bootstrap
public
..
html and aaa.com are pure html project, and bbb.com is a lumen project, when I add a .htaccess file , the site will always get the 500 Internal Server Error.
if I remove the .htaccess the site will get the 403 Forbidden (because of Options FollowSymLinks MultiViews, I guess), how to correctly rewrite the lumen site for bbb.com ? any idea?
bbb.com.htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
/etc/apache2/sites-available/bbb.com.conf :
<VirtualHost *:80>
ServerAdmin bbb#gmail.com
ServerName bbb.com
ServerAlias www.bbb.com
DocumentRoot /var/www/www.bbb.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/www.bbb.com/public_html>
Options FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>

Apache 403 (Forbidden) on subdirectory on Windows

So yesterday i installed Apache 2.2, PHP 5.3, and MySQL on my Windows 8 Machine. I am using the same vhost / .htaccess files on both but it works on my Mac and not Windows. Basically When i go to "mysite.dev" it renders the homepage of the site, but once i go to any page, such as "mysite.dev/about/" i get a 403 Forbidden Error.
I have verified that Apache runs as "System" on my computer and then made sure all permissions from the site folder to root are set to Full Access for the user/group System.
I've tried many many things and cant figure this out and its rather annoying. Anyways i've posted below all of the settings / logs. Thanks in advanced.
vhosts:
<VirtualHost *:80>
ServerAdmin MyEmail#gmail.com
DocumentRoot "C:/Users/Michael/Dropbox/Sites/onmytv"
ServerName onmytv.dev
ServerAlias www.onmytv.dev
<Directory "C:/Users/Michael/Dropbox/Sites/onmytv">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php/$1 [L]
Error displayed on webpage:
Forbidden
You don't have permission to access /C:/Users/Michael/Dropbox/Sites/onmytv/index.php/about/ on this server.
error.log
[error] [client 127.0.0.1] (20023)The given path was above the root path: Cannot map GET /about/ HTTP/1.1 to file
access.log
127.0.0.1 - - [02/Nov/2012:17:57:17 -0400] "GET /about/ HTTP/1.1" 403 256
The solution was to change the following the in .htaccess file
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php/$1 [L]
to
RewriteRule ^(.*)$ index.php/$1 [L]
Thanks #Svetlio for that useful comment :)
Use this:
<VirtualHost *:80>
ServerAdmin MyEmail#gmail.com
DocumentRoot "C:/Users/Michael/Dropbox/Sites/onmytv"
ServerName onmytv.dev
ServerAlias www.onmytv.dev
<Directory "C:/Users/Michael/Dropbox/Sites/onmytv">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>

Categories