I've just installed nginx, got it working, but I can't get my index.php to resolve.
I was getting 403 errors until I changed permissions, and now I get 404 errors.
The 403 is in /var/log/nginx-error.log and 404 in /var/log/nginx-access.log.
So nginx is working fine.
But I'm not sure if php-fpm is working.
To test I comment out the block in the config that 'passes the PHP scripts to FastCGI server listening on 127.0.0.1:9000'.
Nginx then asks me to open/save the index.php it otherwise should be rendering as html after php-fpm/fastcgi executes the php.
But I can't seem to configure this block (uncommented) to get php-fpm to work and send back html to nginx.
I installed from source so I could use the third party auth digest module (which isn't working yet), so user, pid, and some other directives were configured then. The prefix I set was /usr/local/etc/ningx.
Here's my config:
I've tried setting:
as
and I've tried adding a trailing slash to end of root dir's but still no joy.
Here's the included fastcgi_params file:
I've tried turning fastcgi_intercept_errors on; but this doesn't show any more error info.
Can anyone see anything I've missed?
I installed following these howtos:
http://bin63.com/how-to-install-nginx-and-php-fpm-on-freebsd
http://interfacelab.com/nginx-php-fpm-apc-awesome/
and I've checked my config against the nginx docs.
The things I can think I've done wrong is not installing PHP with CLI, as per the first link, not enabling php-fpm, or I've screwed up a path in nginx.conf (above).
I was getting 403 errors until I changed permissions, and now I get 404 errors.
The 403 is in /var/log/nginx-error.log and 404 in /var/log/nginx-access.log.
So nginx is working fine.
But I'm not sure if php-fpm is working.
To test I comment out the block in the config that 'passes the PHP scripts to FastCGI server listening on 127.0.0.1:9000'.
Nginx then asks me to open/save the index.php it otherwise should be rendering as html after php-fpm/fastcgi executes the php.
But I can't seem to configure this block (uncommented) to get php-fpm to work and send back html to nginx.
I installed from source so I could use the third party auth digest module (which isn't working yet), so user, pid, and some other directives were configured then. The prefix I set was /usr/local/etc/ningx.
Here's my config:
Code:
#user nobody;
worker_processes 2;mydomain
error_log /var/log/nginx-error.log warn;
#pid logs/nginx.pid;
events {
worker_connections 1024;
use kqueue;
}
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 off;
server_tokens off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 5;
port_in_redirect off;
#gzip on;
server {
listen 8082;
server_name www.mydomain.com;
server_name_in_redirect off;
auth_digest_user_file /usr/local/www/passwd.digest;
location /private{
auth_digest 'These are not the interwebs you are looking for';
}
access_log /var/log/nginx-access.log main;
location / {
root /usr/local/www/mydomain.com/public;
index index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/local/www/mydomain.com/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
I've tried setting:
Code:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
as
Code:
fastcgi_param SCRIPT_FILENAME /usr/local/www/mydomain.com/public$fastcgi_script_name;
and I've tried adding a trailing slash to end of root dir's but still no joy.
Here's the included fastcgi_params file:
Code:
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_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 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;
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;
fastcgi_intercept_errors on;
I've tried turning fastcgi_intercept_errors on; but this doesn't show any more error info.
Can anyone see anything I've missed?
I installed following these howtos:
http://bin63.com/how-to-install-nginx-and-php-fpm-on-freebsd
http://interfacelab.com/nginx-php-fpm-apc-awesome/
and I've checked my config against the nginx docs.
The things I can think I've done wrong is not installing PHP with CLI, as per the first link, not enabling php-fpm, or I've screwed up a path in nginx.conf (above).