I built a linux server on digitialocean and installed require software and clone laravel files from github to /var/www/html/. I get this error
"The 138.68.81.200 page isn’t working" in http://138.68.81.200/socialNetwork/public/
Even though uploading migrations and create .env files and storage/* 777 permission.
How can I solve this problem ?
Assuming that you have installed all php packages and dependencies and all project vendors via composer. You just need to add this to /etc/apache2/sites-available/000-default.conf
Alias /socialNetwork /var/www/html/socialNetwork/public/
<Directory "/var/www/html/socialNetwork/public">
AllowOverride All
Order allow,deny
allow from all
</Directory>
And then add this in your /var/www/html/socialNetwork/public/.htaccess :
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
After that:
sudo service apache2 restart
Related
I try to deploy my laravel app to heroku but while running heroku after completing all steps it show the following error
My ht access file is
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Creating a Procfile
By default, Heroku will launch an Apache web server together with PHP to serve applications from the root directory of the project.
However, your application’s document root is the public/ subdirectory, so you need to create a Procfile that configures the correct document root:
On terminal of project directory, perform following (for Windows)
echo web: vendor/bin/heroku-php-apache2 public/ > Procfile
then do Git add, Commit, Push
-Source Heroku Documentation
I think the problem is here:
access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
The key point is
Require all denied
You should change the denied to granted
Did you deploy the app on Heroku correctly? Can you check whether you did the following things?
Create Heroku App
Create Procfile On Root Directory Of Project
Modify composer.json
Get Your Project Files Up-to-date
Add Your Project Files To Heroku
Setup Database Connections *
If you have missed any step, do it and try again. The complete guidance to Deploy, Build, Run, and Operate Laravel Applications On Heroku Cloud Application Platform is included in the following blog article with all the steps and information you need.
Read: Laravel: Deploy Laravel Projects On Heroku
https://www.ashenlive.com/blog/laravel-deploy-laravel-projects-on-heroku
I got the same issue and found a solution. It is about Heroku can't find an index file (index.php,index.html) in the directory.
For example, if you can't reach files under the root directory, you should add an index file there. In my case, I had a root directory and had an index.php file so I could reach the files in it. But also there was another folder under the root directory which I couldn't enter. So I created an empty index.html file there too.
Then the issue was solved.
in Procfile you have edit it and replace the code to
web: heroku-php-apache2 public/
now update your Procfile by this commend in cmd
git status
git add -A
git commit -m "Add Procfile and make use of Apache2"
git push heroku master
I hope it will be fixed
I have a domain say www.example.com and on the root of the domain I have a folder called development. Inside development I have a folder called hunterlp and inside the hunterlp folder all my laravel files are placed when I navigate to http://www.example.com/development/hunterlp/ i am greeted by a 500 internal server error.
I moved all my folders from public to the hunterlp root folder and placed a .htaccess with the following in
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
How can I make my laravel site work in that folder?
please follow this instruction its work for you
1. connect to hosting via SSH
2. install composer
3. in cpanel open Select PHP version and choose 5.4. (I also set phar extension)
4. install laravel: php composer.phar create-project laravel/laravel myproject --prefer-dist
5. copy everything from myproject/public to public_html
6. open public_html/index.php and set:
7. require __DIR__.'/../myproject/bootstrap/autoload.php';
8. $app = require_once __DIR__.'/../myproject/bootstrap/start.php';
for the 7 and 8 steps give the path where you source has so that file find that files
Hope this is works.
how to install laravel on hostinger server/ any other free hosting server. I had learned and done working codes in localhost. But i would like to run it on a real server.
Laravel Version : 5
PHP Version Server :5.5.35
1) I had copied the full laravel code to "/home/< username >/"
2) copied the files in /home//laravel/public to /home/< username >/public_html
But it shows an error.
Fatal error: require(): Failed opening required '/home//public_html/../bootstrap/autoload.php' (include_path='.:/opt/php-5.5/pear') in /home//public_html/index.php on line 22
Answer :
Use Heroku Server as #lciamp Suggested in the comment
Clarification :
Please suggest me a list of Payed Servers which support Laravel Framework
Since you have SSH access do this:
Filesystem
SSH into the server
Change directory to the project root
cd /home/< username >
delete the public_html folder
rm -rf public_html
create a symbolic link from public to public_html
ln -s /home/< username >/public /home/< username >/public_html
Install Laravel dependencies
composer install
Change permissions
chmod -R 755 *
chmod -R 777 storage/ bootstrap/cache/
Checklist
Make sure your environment file uploaded and is proper.
If the server is Apache, make sure you uploaded the .htaccess files.
You probably uploaded all the assets, if so you will not need to do bower or npm.
Restart the server.
**In Case of a Limited Shell Environment
Install Laravel dependencies locally and upload the vendor folder with everything else.
Instead of uploading the whole Laravel app to /home/< username >/ upload it to /home/< username >/public_html.
Modify your /home/< username >/public_html/.htaccess to redirect all requests to the public subfolder.
# /home/< username >/public_html/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect All Requests To The Subfolder
RewriteRule ^ /public
</IfModule>
Make sure you have the proper /home/< username >/public_html/public/.htaccess (GitHub).
# /home/< username >/public_html/public/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
After you copy the code to your hosting server, you need to install the composer packages required to run Laravel. You can do this using composer install (providing that composer is installed). Otherwise, you need to install composer first.
I haVE my page hosted in Amazon EC2, it was working well in the root of the apache server (/var/www/html). But i want to have an other page in the same server so i start moving it to a subfolder (/var/www/html/alqip/public) so i can setup the second website in (/var/www/html/page2).
The site is developed in Laravel 5 and it is showing a blank page without login any error in laravel logs and system logs either (syslog, apache logs, php logs).
The permissions of storage folder are 777.
This is my .htaccess in public/ folder:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
And my page.config in /var/apache2/sites-available:
<VirtualHost *:80>
ServerName alqip.com
ServerAlias www.alqip.com
DocumentRoot "/var/www/html/alqip/public"
<Directory "/var/www/html/alqip/public">
AllowOverride All
</Directory>
</VirtualHost>
I think the problem is in Laravel, not in server configuration, what do you think? Thanks!
Verify the firewall is down and if you are on centos check the configuration of the selinux. For default the selinux is enable edit the file /etc/selinux/config
SELINUX=disabled
After disbled you have to reboot you server
after installing Laravel you must create the .env file using the .envexample template.
the next problem you will have is permission issues
Its caused because php is running as another user by default.
so to fix this do
sudo nano /etc/php/7.0/fpm/pool.d/www.conf
then edit the
user = "put user that owns the directories" group = "put user that owns the directories"
then:
sudo systemctl reload php7.0-fpm
Am trying to get to the laravel welcome screen while running Apache on Ubuntu.
Here are the steps I take:
1) I download composer.phar file
2) I create new laravel project with:
composer create-project laravel/laravel --prefer-dist
Now I have laravel project in my var/www/html folder.
3) Now I create a virtual host file called myapp.conf in apache2/sites-available folder.
Content of that file is as follows:
<VirtualHost *:80>
# Host that will serve this project.
ServerName app.dev
# The location of our projects public directory.
DocumentRoot /var/www/html/nino-laravel-project/public
# Rewrites for pretty URLs, better not to rely on .htaccess.
<Directory /var/www/html/nino-laravel-project/public>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
Now when I type app.dev in my browser all I get is Apache's welcome screen.
Note that I have installed all other requirements like PHP5, crypt etc..
What am I missing here?