Welcome! Log In Create A New Profile

Advanced

Lock users on homedir - PHP-FPM + Nginx

Posted by e0xbr 
Lock users on homedir - PHP-FPM + Nginx
June 29, 2012 09:04PM
Hello Guys..

I'm new around here.
All my life I used cPanel with reverse nginx proxy, but now I want to build a server with nginx and php-fpm.

Everything is configured.
Nginx, mysql, pureftp....

I created two test account

/home/account1
/home/account2

I can access these accounts using
http://account1.myserver.local
http://account2.myserver.local

Like a shared server....all fine here..


MY PROBLEM: Using php's fopen/fget / I can get all dirs and files from account2 from account1...


My folder's config:

drwxr-xr-x. 3 account1 account1 4096 Jun 29 17:53 account1.myserver.local
drwxr-xr-x. 5 account2 account2 4096 Jun 29 18:03 account2.myserver.local

My nginx configuration:
user nginx;

------------------------------------------

My vhost configuration is default..here the important part:
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /home/$server_name/$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}


---------------------------

Now, I hope I could explain it...

How can I "isolate" each user on their specific folder?
I don't wan't to user 1 list / edit / view the content of user 2...

How can I do that?

Server specs:
CentOS 6 - PHP 5.4.4 - nginx/1.0.15
Re: Lock users on homedir - PHP-FPM + Nginx
June 29, 2012 11:00PM
Hello,

1. You can use "open_basedir" php.ini directive per host.

2. You can create separate users and php-fpm pools with appropriate settings per site.

You can also use both.

Andrejs
Re: Lock users on homedir - PHP-FPM + Nginx
June 30, 2012 12:44AM
Hello

It is weird...
I got this message now Fatal error: date(): Timezone database is corrupt - this should *never* happen!

Is there something I need to do to avoid it?
I set on /etc/php.ini date.timezone ...I'm searching for this error...
Re: Lock users on homedir - PHP-FPM + Nginx
June 30, 2012 01:47AM
Hello

I could solve the problem, but it was in a not correct way...

I created a folder at /home/account1/usr/share/zoneinfo/America/Sao_Paulo and copied the file there...
Now it worked but it is not correct...

How can I fix it?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready