Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

Nginx Problem

Nginx Problem

LivingSouLLivingSouL Member
edited April 2012 in Help

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

My Own Universe | ChatX IRC Network irc.chatx.net:6667

Comments

  • chown the files to the user running nginx (www-data probably) ?

    I use http://tuxlite.com to configure all my VPSes and I love it!

    Thanked by 1yomero
  • Or use PHP-FPM :P

  • NickMNickM Member

    The directory itself needs to be 755. Without the execute bit, PHP can't read anything from the directory.

    Lead Developer - HostGuard Control Panel

  • @djvdorp said: chown the files to the user running nginx (www-data probably) ?

    Done this already, still the same...

    @NickM said: The directory itself needs to be 755. Without the execute bit, PHP can't read anything from the directory.

    Done this too...

    @yomero said: Or use PHP-FPM :P

    I'm a n00b on nginx... Hehehe I'm not sure how to do that :D

    My Own Universe | ChatX IRC Network irc.chatx.net:6667
  • 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.

  • NickMNickM Member

    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.

    Lead Developer - HostGuard Control Panel

  • @NickM said: 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.

    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.. :)

    @yomero said: With fpm you create pools of php processes running with the user that you want.

    Thanks mate.. I'll look this up..

    My Own Universe | ChatX IRC Network irc.chatx.net:6667
  • NickMNickM Member

    @LivingSouL said: Hmmm... Isn't this dangerous or something? If I have 755 permission on /home/user anybody can see what's in that directory?

    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 then chmod 750 the directories, and chmod 740 the files.

    Lead Developer - HostGuard Control Panel

    Thanked by 1LivingSouL
Sign In or Register to comment.