move laravel to live web - php

Hi I have my website which its my resume and now I want to show the project that I have done one of my project is laravel and I move it to: public_html/laravel
and also move my DB to there but I get this error:
403 Forbidden
You don't have permission to access /laravel/ on this server.
I don't understand is it because of I didn't put files on main public_html and move it to folder or other stuff I also changes(i don't know if its right) change config/database.php mysql part to database configuration but I keep getting this error

Laravel server files from the public/ directory. So try a URL like this instead:
http://example.com/laravel/public
If that works, you'll need to move some files around a bit. This should help with moving things around:
How to change public folder to public_html in laravel 5

If you use shared hosting then please do not uplaod whole laravel application to the publitc_html folder. You have to upload your all application at global document root for your domain like home/yourdomainand you have to rename existing public_html folder to any name and rename laravel public folder to public_html and try again. See the image below:

Related

Will there be any issue if I redirect laravel project root path to public directory?

I want to deploy the Laravel project to my shared hosting.
When I go to my site main domain (example.com) It displays all directory and files but (example.com/public) works fine.
What if I just create an index.php file in the project root directory with following code
<?php
header('Location: ./public');
?>
It just redirects me to example.com/public.
Just tell me if there will be an issue that may occur at any point?
I am new to Laravel.
I don't care to remove the public directory. I only care if someone goes to example.com then it just redirects example.com/public to work fine.
Update
Just keep it short and simple answer (Yes/No) then explain it.
Is there will be an issue that occurs with the above steps (actions)? (Yes/No)
did you point your vhost to to the public directory?
For Apache
DocumentRoot [Laravel root direcoty]/public
For Nginx
root [Laravel root direcoty]/public;
Laravel Deploment
I'd suggest the easy way, by create a symbolic link of public_html and link it to your laravel project's public directory. don't forget to set your project folder permission.
here's the example: https://blog.netgloo.com/2016/01/29/deploy-laravel-application-on-shared-hosting/

Laravel 404 error while viewing image saved in public directory of laravel project

I created Laravel project and able to make it work to get json output as well. However image link in json is not working.
https://android.factory2homes.com/
json: https://android.factory2homes.com/index.php/api/products
image link:https://android.factory2homes.com/index.php/public/12142.jpg
i tried creating symlink and copied same image in storage folder as well, but not able to make it work.
The public folder in a Laravel project is basically the root folder that shows up on the website URL.
For security issues, you really don't want the users to have the ability to write anything directly on the public folder, because if you are not careful they could overwrite your php scripts and have them do whatever they want.
So generaly speaking you create a simlink inside the public folder to the storage folder that is outside the public directory. Laravel has even a built in artisan command to do that exactly which is:
php artisan storage:link
The URL to any image stored in that folder would be in your example:
https://android.factory2homes.com/storage/12142.jpg
You do not have to put any .php file, or public or anything else.
if the image is inside public then I don't think you need to give the url like index.php/public/someimage.jpg you can just do www.yousiteurl.com/someinage.jpg
I resolved issue by savings images to Public_html folder instead of public folder in Laravel app root folder. Public_html is the path that is visible to public, hence other solutions weren't working.

laravel 5.5 I can not upload my project to the server

I am trying to upload my project to a shared server but I can not, the steps I have followed have been the following:
1- I created a folder outside of public_html and I called it mascotas, there I stored all the folders except the public folder
being as follows:
2.-inside public_html I have saved everything inside the public folder
3.- I have changed the routes within the index file so that they point to the vendor folder, however the error continues, what should I do?
I've resolved it, all was caused by the version of php

How to upload the laravel 5.2.42 project to cPannel?

please guide me how to upload the Laravel project to my cPanel I am very much confused.
you should add all the folders of laravel inside of public_html folder, and you need to move index.php and .htaccess file to the public_html directory from public directory. Now make changes index.php like this.
require DIR.'/bootstrap/autoload.php';
$app = require_once DIR.'/bootstrap/start.php';
That may work for you.
If you check your laravel project, there is a public folder inside it.
By default, your domain is pointed at the root level or on public_html. On you cPanel Domain settings, make sure your domain is pointed your Laravel application public folder.

Affect on security of Laravel 5 when change folder structure to remove public folder

I'm new in Laravel 5.
I found this Laravel 5 - Remove public from URL on Stack Overflow to remove public folder from my Laravel 5 App. Only I have a question about the security.
When I am removing public from URL, then I have to change the basic folder structure of Laravel 5. Yes, it's working fine without the public from the URL.
But what's about the security of Laravel, because I am changing the default folder structure? Is it secure to use?
You should be pointing your Apache host root to the $LARAVEL_PATH/public directory instead of $LARAVEL_PATH.
The point of having sub directory for www host root instead of project root is that you're not leaking any of your project files through your web server.
Even though all the PHP files have the file suffix .php, malicious user can access your $LARAVEL_PATH/storagedirectory and its subdirectory contents, read your composer.json or package.json to find vulnerable dependencies or read .env file etc.
If you're running on shared hosting and you have mandatory public_html, try installing Laravel outside of that public_html directory and either removing public_html (if empty) and replace it with symlink to $LARAVEL_PATH/public OR if you want the Laravel instance to be subdirectory ofpublic_html, do the same but create symlink from$LARAVEL_PATH/publictopublic_html/$PROJECT_SUBDIR`.
That public directory is there for reason to make project a bit more secure. Solve the actual problem and don't try to break this simple but nice security addition. :)
you this link you provided is not about changing the actual file structure of the framework, this example uses mod_rewrite to rewrite the url of your application. In other words you are telling your server that you would like to point to that directory without the full path is visible to the end user.
Also take a look on the below answers of the link you've provided.
Rename the server.php in the your Laravel root folder to index.php and
copy the .htaccess file from /public directory to your Laravel root
folder. -- Thats it !! :)

Categories