标题说明全部......以下是我的配置文件。
必须有许多其他人正在寻找FastCGI配置问题的更新解决方案。
的Merci!
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
curl -i http://ipaddress
HTTP/1.1 200 OK
Server: nginx/1.10.2
Date: Tue, 28 Mar 2017 21:18:20 GMT
Content-Type: application/octet-stream
Content-Length: 1780
Last-Modified: Thu, 15 Dec 2016 15:20:08 GMT
Connection: keep-alive
ETag: "5852b4a8-6f4"
Accept-Ranges: bytes
nginx / php-fpm在日志中没有生成错误
nginx访问日志生成如下。
192.88.135.5 - - [28/Mar/2017:13:18:38 -0400] "GET / HTTP/1.1" 200 1780 "-""Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1144"
.sock路径目录中的文件
-rw-r--r--. 1 root root 5 Mar 28 18:13 php-fpm.pid
srw-rw----. 1 nginx nginx 0 Mar 28 18:13 website.com.sock
nginx版本:nginx / 1.10.2 PHP 7.0.16(fpm-fcgi)(建于2017年2月18日10:26:54)
nginx.conf
user nginx nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
upstream php {
server unix:/var/run/php-fpm/website.com.sock;
}
server {
include /etc/nginx/conf.d/default.conf;
include /etc/nginx/sites-available/*.conf;
}
}
default.conf
include /etc/nginx/security;
#expires max;
#Uploads configuration
client_max_body_size 32m;
位点可用/ site.conf
listen [::]:80;
server_name *.website.com;
root /some/directory/website/;
access_log /var/log/nginx/www.access.log;
error_log /var/log/nginx/www.error.log notice;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#Index targets
index index.php index.html index.htm;
location / {
# redirect admin/auth
#rewrite ^/(admin|auth)(.*) https://$host$request_uri?;
# try_files $uri =404;
# #fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri $uri/ /index.php$is_args$args;
}
# if the file being requested ends in ".php", it's something
# that PHP-FPM should process, so hand it to upstream server
location ~ \.php$ {
fastcgi_pass php;
}
PHP-FPM / www.conf
; Start a new pool named 'www'.
[www]
ping./var/run/php-fpm/website.com.sock = /ping
listen = /var/run/php-fpm/website.com.sock;
pm = dynamic
pm.status_/var/run/php-fpm/website.com.sock = /status
user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
fastcgi.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
# To use NGINX + Virtual Host + PHP you should ommit the SCRIPT_NAME variable in order for
# PHP to choose the correct DOCUMENT_ROOT.
#fastcgi_param SCRIPT_NAME $fastcgi_script_name;
#
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;