8

My laravel Application was working perfect on the local server. But After I uploaded it to my server it is not working. The directory structure of my application is shown in the following image: enter image description here

And I am getting the following problem. It is automatically redirected to loopback address showing nothing enter image description here

Here is my php version in the server

enter image description here

Kutumb Kutumb
  • 205
  • 1
  • 2
  • 12
  • you dont have a .env file and try changing the root directory to myweb.dev/public – Achraf Khouadja May 16 '16 at 16:54
  • 1
    This is old thread.. You should not upload vendor directory over server, execute "composer install" & "php artisan key:generate" from root of your server. Then clear config, cache & view using artisan. – Kamal Joshi Oct 24 '18 at 08:42
  • Move all your code into the `public_html` folder. I can't see public folder in laravel app. It's not good idea to change anything in laravel default thing. – Mayank Dudakiya Apr 10 '19 at 13:54
  • You just need to set document root to public folder in your domain to remove public nothing else. – Mayank Dudakiya Apr 10 '19 at 13:57

5 Answers5

4

Make sure you have correct web server configuration. You should point web server to a public directory and restart it.

Also, make sure you've set correct permissions on a storage directory:

chmod -R 775 storage

And try to clear all cache:

php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
php artisan clear-compiled
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
0

I had trouble with this also. What you have to do is put the "public" folder in your "www" directory (or the appropriate public_html folder if you use a virtual machine). Next you have to put the WHOLE application in your var folder in a directory of your choice, lets call it "MySuperCoolFolder". Finally, you have to modify the index.php file. More specifically, these two lines.

require __DIR__.'/../bootstrap/autoload.php';

to

require __DIR__.'/../MySuperCoolFolder/bootstrap/autoload.php'; 

and

$app = require_once __DIR__.'/../bootstrap/app.php';

to

$app = require_once __DIR__.'/../MySuperCoolFolder/bootstrap/app.php';

And that should do it. If it does not work. Go to the documentation and use the .htaccess file they provide. That did the trick for me.

Best of Luck!

Reference: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e#.nvinp0r3e

ThomasK
  • 300
  • 1
  • 8
0

In My case I folowed this link Deploying your Laravel Project to 000webhost

instead of public_html my folder's name was mysite.com. Did the all pointed there also cleared caches , bootstrap folder and put storage folders permission to 755, set APP_URL to new one but still didnt get it shown up. Then after a little bit I looked at the server something like traffic per day and went to open the page via VPN... Boom. Now I see its working ok

CodeToLife
  • 3,672
  • 2
  • 41
  • 29
-2

Try visiting http://127.0.0.1/Workshop/public_html

There is no index.php or .htaccess in the Workshop folder. These would normally be inside public but looks like you have public_html instead

Mark Walker
  • 1,199
  • 11
  • 20
  • Are you sure about that? I don't think that `127.0.0.1` is the IP of any public, non-local webserver – Nico Haase Apr 10 '19 at 13:53
  • 127.0.0.1 is a loopback address, definitely not public IP. But lack of standard /public folder remains true. which contains keys files in any laravel app. – Mark Walker Apr 11 '19 at 16:09
-2

If you are placing the Laravel app inside the public_html or inside a subfolder, you have to set some rules for the .htaccess. Please refer to this answer:

https://stackoverflow.com/a/30497841/7801507

If you want to install the web app on the root of the server, please place all the content of the application in the root directory and rename the public folder to the public_html or www or web, whatever is the public folder of your domain.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
Hamza Awan
  • 122
  • 1
  • 7
  • 1
    Please don't use only a link in your answer - it contains completely different steps than the stuff you wrote in your answer itself – Nico Haase Apr 10 '19 at 13:54