我有一个干净的Centos 6.4(x64)最小版本安装(完全更新)。
一旦操作系统安装完成,我按照这个相对简单的指南设置我的FTP: http : //www.krizna.com/centos/how-to-configure-ftp-server-on-centos-6/
SELinux is disabled. anonymous_enable=NO (vsFTPD Config) chroot_local_user=YES (vsFTPD Config)
而不是根据/ ftp / [username](根据指南)创build一个linux本地用户,我select使用/ home / [username]的标准位置,其中[username]是服务器 (在我的设置中)
我testing了我的FTP服务器,并安装并正常运行。 所以我login到FTP并创build了一个名为“public_html”的文件夹,然后用<?php phpinfo(); ?>在其中创build了一个index.php文件<?php phpinfo(); ?> <?php phpinfo(); ?>代码在里面。 (所以完整path是:/home/server/public_html/index.php)
然后,我安装了nginx&php-fpm,并按顺序为每个configuration文件创build了下列configuration文件。
/etc/php-fpm.d/server.conf (我的本地nix acc:server的php-fpm池):
[server] listen = '/var/run/php-fcgi-server.sock' listen.allowed_clients = 127.0.0.1 user = server group = server pm = static pm.max_children = 5 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 10 pm.max_requests = 200 php_admin_value[error_log] = /var/log/php-fpm/server-php-errors.log php_admin_flag[log_errors] = on php_admin_flag[display_errors] = on
/etc/nginx/conf.d/dev-minecraft.local.conf(nginx vHost):
upstream serverbackend { server unix:/var/run/php-fcgi-server.sock; } server { listen *:80 default; server_name dev-minecraft.local; root /home/server/public_html; location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; } client_max_body_size 10M; location /. { return 404; } location @handler { rewrite / /index.php; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass serverbackend; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
现在,如果我访问该网站没有我的浏览器: http://dev-minecraft.local/我得到以下错误: 500内部服务器错误
我在/var/log/nginx/error.log文件中看到以下错误:
2013/07/22 12:58:07 [crit] 2039#0: *1 stat() "/home/server/public_html/" failed (13: Permission denied), client: 192.168.1.15, server: dev-minecraft.local, request: "GET / HTTP/1.1", host: "192.168.1.54" 2013/07/22 12:58:07 [crit] 2039#0: *1 stat() "/home/server/public_html/" failed (13: Permission denied), client: 192.168.1.15, server: dev-minecraft.local, request: "GET / HTTP/1.1", host: "192.168.1.54" 2013/07/22 12:58:07 [crit] 2039#0: *1 stat() "/home/server/public_html/index.php" failed (13: Permission denied), client: 192.168.1.15, server: dev-minecraft.local, request: "GET / HTTP/1.1", host: "192.168.1.54"
任何想法我在这里做错了吗? 有一点我注意到在WinSCP(我通过FTPlogin后),文件所有者/组被设置为数字标识符(500),而不是帐户用户名“服务器”。 这是为什么nginx / php-fpm无法访问站点文件? 我怎样才能解决这个问题?
/home/server的权限拒绝任何人的访问权限,但它的所有者。 那是drwx------意思。
要解决此问题,请允许其他用户下载到目录中。
chmod a+x /home/server
绝对是一个权限问题。 php-fpm用户和nginx用户必须具有对目录中文件的读取权限。 你的nginxconfiguration也有点问题。 请尝试以下操作:
client_max_body_size 10M; index index.html index.php; upstream serverbackend { server unix:/var/run/php-fcgi-server.sock; } server { server_name dev-minecraft.local; root /home/server/public_html; expires 30d; location / { location ~ \.php$ { expires off; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass serverbackend; } try_files $uri $uri/ =404; } }