I am trying to deploy laravel 5.1 project on AWS EC2 cloud server and having an issue with laravel web site route URLs.
I ran the following commands to configure the EC2 ubuntu 14.04 LTS server.
sudo apt-get install apache2
sudo apt-get install mysql-server php5-mysql
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install php5 php-pear
sudo apt-get install curl php5-curl php5-cli git
sudo a2enmod rewrite
sudo php5enmod mcrypt
sudo service apache2 restart
getting the following error when I try access any route URLs but my home page is loading correctly.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /register was not found on this server.</p>
<hr>
<address>Apache/2.4.7 (Ubuntu) Server at xxxx.ap-southeast-2.compute.amazonaws.com Port 80
</address>
</body></html>
I have changed the apache route URL to the public folder of my laravel project without any success. Also I tried to enable the following virtual host file but still got the same error.
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/mynewhost/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I ran the following command to grant permission to the storage folder
chmod -R 777 storage
do I need to grant any permission to my laravel project folder?
appreciate any help.
This is my configuration for Laravel 5.1 on Ubuntu 14.04
You might need to enable your rewrite engine
sudo a2enmod rewrite
If that doesn't work you can change the virtualhost configuration to something like this
<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/html/mynewhost/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/mynewhost/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Additionally add the ServerName to /etc/hosts
<your-server-ip-address> laravel.example.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With