nginx.conf可以配置 不同的用户
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
里面配置php的启动的走的sock
然后php的sock里面也可以配置不同用户
1、
创建第二个php-fpm进程所使用的主配置文件
复制主配置文件 cp /etc/php-fpm.conf /etc/php-fpm2.conf
2)复制子配置文件 cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www2.conf (注意子配置文件名会跟我这里有所不同注意www.conf是否存在,用存在的作为复制对象)3)更改子配置文件 www2.conf的配置
listen = 127.0.0.1:9001 – 更改www2.conf 的监听端口
4)更改主配置文件php-fpm2.conf的配置
include=/etc/php-fpm.d/www2.conf – 将配置改成复制出来的www2.conf
pid = /run/php-fpm/php-fpm2.pid – 区分php-fpm2的pid 方便之后对该php-fpm进行关闭启动
5)启动php-fpm2.conf
linux命令:/usr/sbin/php-fpm -y /etc/php-fpm2.conf – 启动php-fpm:php-fpm启动脚本 -y php-fpm配置。对该命令不解的自行百度,php-fpm命令解析
6)检查是否成功启动php-fpm2
linux命令:ps aux | grep php-fpm
2、
like this /opt/php-5.6.3/etc/fpm.d/user1.conf
[user1]
listen.owner = user1
listen.group = user1
user = user1
group = user1
listen = /opt/php-5.6.3/sockets/user1.sock
listen.mode = 0666