In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the "how to set Laravel directory permissions" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
If you give permission to any folder 777, you are allowing anyone to read, modify, and execute any file in that directory. This means that you have given anyone (any hacker or malicious person in the whole world) permission to upload any file, virus or any other file, and then execute the file.
If you are setting your folder permissions to 777, you have turned on your server to anyone who can find the directory. Do you get it?
Anyone's logo means any user, not anyone. You still need server access.
There are basically two ways to set your ownership and permissions. Either give yourself ownership or make the web server the owner of all files.
Webserver as the owner (what most people do, and what Laravel doc does):
Suppose www-data is your web service user (it could be another name, too).
Sudo chown-R www-data:www-data / path/to/your/laravel/root/directory
If you do this, the files owned by the web service will also become this group, so you will have some problems when uploading files using FTP, because the FTP client will log in with your account, not your web service, so you should add your users to the user group of the web service.
Sudo usermod-a-G www-data ubuntu
Of course, this assumes that your web service runs as a www-data user (the Homestead default) and that your user is ubuntu (or vagrant in Homestead). Then set all your directories to 755 and all your files to 644.
Sudo find / path/to/your/laravel/root/directory-type f-exec chmod 644 {}\
Set directory permissions
Sudo find / path/to/your/laravel/root/directory-type d-exec chmod 755 {}
Your user as the owner
I prefer to have all the directories and files (which makes everything easier to do), so go to the laravel root directory:
Cd / var/www/html/laravel > > assuming this is your current root directorysudo chown-R $USER:www-data.
Then I give myself and the website server two permissions:
Sudo find. -type f-exec chmod 664 {}\ sudo find. -type d-exec chmod 775 {}\
Then give the web server the right to read, write, store and cache.
No matter how you set it, you need to give the web server read and write access to store, cache, and any other directories that the web server needs to upload or write (depending on your situation), so run the following command:
Sudo chgrp-R www-data storage bootstrap/cachesudo chmod-R ug+rwx storage bootstrap/cache
Now, your website is secure and you can easily deal with these files.
This is the end of "how to set Laravel directory permissions". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.