New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Nginx Problem
LivingSouL
Member
Hi guys, I'm wondering why this happened on my setup. I've used the script here on LEB before that optimizes fresh LEB to minimal, but not the latest one. I've used the one that changes
root@server:~#
into colors green and blue (directory)...
My problem is, I've made HTTP folders on a user and told nginx to redirect to that folder when URL is entered, (www.example.com). I know it does go to that folder but doesn't run the PHP files, unless I do
chmod 755 -R /home/user/http/example.com
but that isn't recommended right?
How do I do this so that nginx should run PHP files correctly even on 644?
Thanks
Comments
chown the files to the user running nginx (www-data probably) ?
Or use PHP-FPM :P
The directory itself needs to be 755. Without the execute bit, PHP can't read anything from the directory.
Done this already, still the same...
Done this too...
I'm a n00b on nginx... Hehehe I'm not sure how to do that
Isn't about nginx, is about php :P
But there are several tutorials around for that.
With fpm you create pools of php processes running with the user that you want.
All of the directories need to have the execute bit set. /home, /home/user, /home/user/http and /home/user/http/example.com, and any subdirectories of that that contain PHP scripts to be run. I would double check all of those directories. If that doesn't resolve the issue, please post the exact error message that you're getting in your logs when you visit a PHP page.
Hmmm... Isn't this dangerous or something? If I have 755 permission on /home/user anybody can see what's in that directory?
I'm not sure about this but please enlighten me... Thanks..
Thanks mate.. I'll look this up..
755 will indeed allow any user on the system to read the files and view the directories. If you need more security than that, then you'll need to adjust the permissions and ownership. My recommendation for a more secure setup would be to
chown user:www-data /home/user/http/example.com
(and /home/user/http) and thenchmod 750
the directories, andchmod 740
the files.