Limit user on ftp - ftp

I got this 1tera web host but I only use 10mb.
I'm planning to rent out a folder on my public_html to others where they can use FTP to upload their web files. The problem is I don't know how to limit them from accessing my own public html.

When you create a FTP account using Cpanel, you can create a folder inside public_html and this FTP account will be able to access this folder only, no other folder inside public_html. You can set a folder outside public_html too

Related

Image root issue in laravel in cPanel

Images getting stored in outside public folder and in view, getting called from inside public folder. Everything was working fine in local host. After uploading the project in cpanel i took index.php and htaccess outside public folder. How can i store and call them from same folder? Thank you.
When using Laravel all HTTP Requests has to be hit public directory. But since you are using cPanel all Requests hit directly public_html by default.
You tried to overcome it by moving index.php and .htaccess files to public_html from public_html/public and you broke its structure.
If you have the Administrative (eg: root) access on server, you can solve this by editing your Web server (I assume Apache in your case) to point your domain's requests directly to your Laraval application's public directory.
Usually every Web site in cPanel have separate config files. Their paths something like this:
/var/cpanel/userdata/CPANELUSER/WEBSITEDOMAIN.COM and /var/cpanel/userdata/CPANELUSER/WEBSITEDOMAIN.COM_SSL
In this files there is a documentroot field, it points to public_html directory by default:
documentroot: /home/CPANELUSER/public_html
You need to change it and point it to your application's public directory;
documentroot: /home/CPANELUSER/laravel/project/path/public
After you update both of these files, you need to rebuild your Apache config and restart it;
/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_httpd
If those 2 lines don't work, you can try this 2;
/scripts/rebuildhttpdconf
/scripts/restartsrv_apache
If everything done well, all HTTP Requests will hit your Laravel application's public directory as expected.
After that; if your uploaded files stores in public storage, Laravel puts them in to storage/app/public and you need a symlink to it from public directory.
Laravel creates it when you run
php artisan storage:link
Now all your application's requests as your.domain/storage/bla.jpg will give a response from storage/app/public/bla.jpg
And if you don't have administrative access to server you can check this tutorial: How to deploy Laravel 8 project on Cpanel shared hosting

Laravel, Using a cPanel shared hosting if possible?

I have a shared hosting with bluehost.com... can I just put my project on that.. like upload public files to public_html and others to root directory and backup MySQL DB and upload it to my shared hosting then edit my .env file... will this actually work with Laravel?
I searched most online resources and it requires ssh access to deploy, but the way I explained should not require that right?
I mean this way you don't have to go throw terminal access right?
I used to do that with WordPress when I want to set everything locally then upload it and edit URLs from the dashboard and stuff...
Yes it would work.
But you have to ensure one thing that, in your cpanel your domain point to the /public folder of laravel project.
Normally cPanel points the http requests to public_html folder, but laravel start from its public folder. You can achieve this by two way.
By pointing your server to straight to public folder
Copying the index.php to the public_html, in that case you have to edit index.php to run the laravel project properly. And I don't recommend this step. Step 1 is lot more easier.

How to access public_html in live server?

I store all the images in laravel public/settings folder while uploading images in local.
I have now uploaded my project in live where all the public folder files are moved into the public_html.
Because of this i am facing a problem because i don't know to access the public_html in the cpanel
Store your images in storage or resources directory.
Where it's easy to access.
Try to change the directory and store them into resources/images. Your problem will be gone,

Laravel 5.1 upload on host

I have used the Laravel 5.1 php framework to build a web application on my local XAMPP server.
Which files or folders should be uploaded on my shared host server?
Should the .env file at root be uploaded?
In this case, if sensitive information such as database connection passwords are in this file, is there a security risk?
All project files should be uploaded under project root \var\www\project (project = all laravel project folder and files and \var\www\project\public is where your domain pointing.
Storage should have write permission.
.env will be under project root and it is not available for public access.
.env won't be accessible for public, if it is then you have a configuration problem with you web server.
Move All the files on xyz(your folder name for which domain/subdomain is mapped) folder
Then follow these steps
Go to public folder
Copy .htacsses file
Paste it in xyz folder
Change server.php to index.php
Enjoy and happy coding
This is working fine with hostgator.in shared hosting.

Create an FTP access to a folder with cPanel, but do not give access to subfolders

I created an FTP account for a user, to give him access to a specific folder, but I don't want him to access subfolders.
Is that possible?
On the cPanel documentation I only found the following statement, but it doesn't help so much:
Specify the FTP account's home directory.
The Directory field defines
the top level of directory access that
will be granted to the new account.
For example, an account with a
Directory assignment of /$dir will not
be allowed to access the / (root)
directory; however, it will be able to
access /$dir and all of its
subfolders.
You can set the directory permissions using any FTP program like FileZilla FTP, browse to the folder, right click on it and set the permissions using the permissions menu.

Resources