I just finished setting up a centos 7 server. I have installed PHP 7 with both nginx and apache. I am switching between them on demand for testing.
When I use apache, everything runs ok.
When I use nginx, all static content also works ok.
When trying PHP, all small content works ok. When there is some large content, like the output of phpinfo() or a big SQL SELECT, the script fails without any error (browser says no data).
I checked nginx log and it says some open() to php-fpm failed because of access denied, but I do not see any error, both processes run with the same uid (apache).
Could it be some timeout issue? If not, what else? Configurations added (example.com is the server)
nginx.conf
user apache;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
index index.php index.html index.htm;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
# listen [::]:80 default_server;
server_name examplecom www.examplecom;
root /var/www/example.com/;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
nginx error log
2017/01/07 15:15:38 [crit] 5343#0: *60 open() "/var/lib/nginx/tmp/fastcgi/1/01/0000000011" failed (13: Permission denied) while reading upstream, client: 176.92.90.252, server: example.com, req
uest: "GET /adminer.php?sqlite=.... HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com", referrer: "https://www.example.com/adminer.php?...."
php-fpm configuration unaltered (/etc/php-fpm.conf and /etc/php-fpm.d/www.conf unchanged).
Thanks.