I'm trying to migrate my EC2 server to an ElasticBeanstalk, everything is running except nginx since it lose it's conf
I'm a beginner on AWS so I tried using .platform (.platform/nginx/conf.d/elasticbeanstalk/nginx.conf, I've also tried .platform/nginx/nginx.conf but it doesn't match include conf.d/elasticbeanstalk/*.conf; from the default nginx.conf)
with this code
#Elastic Beanstalk Nginx Configuration File
index index.php;
access_log /var/log/nginx/access.log main;
location /api/ {
if (!-e $request_filename){
rewrite ^(.*)$ /api/index.php last;
}
location /api/ {
try_files $uri $uri/ /api/index.php?$query_string;
}
}
location ~ \.php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8081;
}
But since it didn't seem to work, I tried using .ebextensions with these 2 script
#
# STEP 1 - Create the nginx config file
#
files:
"/tmp/my.nginx.conf" :
mode: "000755"
owner: root
group: root
content: |
#Elastic Beanstalk Nginx Configuration File
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 66966;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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"';
include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}
server {
listen 80 default_server;
server_name http://xxx.xxx.eu-west-1.elasticbeanstalk.com/;
index index.php;
access_log /var/log/nginx/access.log main;
client_header_timeout 180;
client_body_timeout 180;
send_timeout 180;
proxy_connect_timeout 180;
proxy_read_timeout 180;
proxy_send_timeout 180;
keepalive_timeout 180;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
gzip off;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/*.conf;
location /api/ {
if (!-e $request_filename){
rewrite ^(.*)$ /api/index.php last;
}
location /api/ {
try_files $uri $uri/ /api/index.php?$query_string;
}
}
location ~ \.php {
include fastcgi_params;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8081;
}
}
}
And
#
# STEP 3 - Run the script to overwrite the nginx config template.
#
container_commands:
cp_nginx:
command: "yes | sudo /bin/cp /tmp/my.nginx.conf /etc/nginx/nginx.conf"
Am I doing something wrong
In the end I made it works using only one file in .platform/nginx
nginx.conf:
#Elastic Beanstalk Nginx Configuration File
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 66966;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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"';
include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}
server {
index index.php;
access_log /var/log/nginx/access.log main;
client_header_timeout 180;
client_body_timeout 180;
send_timeout 180;
proxy_connect_timeout 180;
proxy_read_timeout 180;
proxy_send_timeout 180;
keepalive_timeout 180;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
gzip off;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/*.conf;
location /api/ {
if (!-e $request_filename){
rewrite ^(.*)$ /api/index.php last;
}
location /api/ {
try_files $uri $uri/ /api/index.php?$query_string;
}
}
location ~ \.php {
include /etc/nginx/fastcgi_params;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:8081;
}
}
}
For the explanation, since the file somehow end up dupplicated, you must remove the servername and listen line from the server section
and replace any relative link with an absolute one (in my case include fastcgi_params; => include /etc/nginx/fastcgi_params;)
Related
images are loading sometimes but icon and default images icons not displayed , im beginner how to fix this issue it drives me crazy, there is no config files in etc/nginx/conf.d only my main nginx config file in my server which found here etc/nginx/nginx.config i hope somone can help me please
my config file
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
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;
client_max_body_size 50M;
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 _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
server_name xxx.com www.xxx.com;
listen serverip;
root /home/xxx/public_html;
index index.html index.htm index.php;
access_log /var/log/virtualmin/xxx_access_log;
error_log /var/log/virtualmin/xxx_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
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_FILENAME /home/xxx/public_html$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/xxx/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
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;
fastcgi_param HTTPS $https;
location / {
try_files $uri $uri/ /index.php?$args;
index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
fastcgi_index index.php;
include fastcgi.conf;
include fastcgi_params;
fastcgi_pass unix:/var/php-nginx/xxx.sock/socket;
}
listen serverip default ssl;
ssl_certificate /home/xxx/ssl.cert;
ssl_certificate_key /home/xxx/ssl.key;
}
}
i appreciate any help
You have one location that sends all requests to PHP. You are not serving static files (such as js/css) with Nginx.
The usual PHP configuration contains two location blocks. One to process URIs which end with .php and one to process everything else as a static file.
For example:
location / {
try_files $uri $uri/ /index.php?$args;
index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
include fastcgi_params;
fastcgi_pass unix:/var/php-nginx/xxx.sock/socket;
}
I tried to find out the solution online but every solution is different. no one is working. I just migrated our web server from Apache to Nginx and I am getting 404 error. Here is the php info: http://likeopedia.net/info.php. If you visit main domain then you will see the error.
I am facing some serious problems for this setup. Our site is working on Apache server but not on Nginx.
here is nginx.conf file that I have changed a little bit.
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
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;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
autoindex on;
index index.php;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/html;
include /etc/nginx/default.d/*.conf;
index index.php index.html index.htm;
rewrite_log on;
location / {
try_files $uri $uri/ /index.php;
location = /index.php {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ \.php$ {
return 444;
}
and here the codeigniter confiq.php file:
$config['base_url'] = 'http://likeopedia.net';
$config['abs_path'] = $_SERVER['DOCUMENT_ROOT'].'/';
$config['logout_url'] = 'http://likeopedia.net';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';
It is now in development mode.
You have enclosed the location = /index.php inside the location /. Try changing the location / so that it does not enclose location = /index.php.
It should look like this:
location / {
try_files $uri $uri/ /index.php;
}
location = /index.php {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.php$ {
return 444;
}
Give it a try and let us know if this helps.
Thank for the feedback - here is what I think you can try as well:
Remove the location = /index.php and instead try the following configuration for the location ~\.php$ declarative:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
I'm working on a server containing a WordPress installation located at http://67.225.176.58/ which is using Nginx, Varnish, and HH-VM and is running really slowly. I was using PHP-FPM with the same results. Please see my Nginx configuration to see how I have it set up and I can give any other configuration files needed. I can't seem to figure out what the issue is.
nginx.conf
worker_processes 24;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 50000;
}
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;
gzip on;
gzip_disable "msie6";
gzip_min_length 1100;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 2;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# increase buffer and timeouts
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;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 4 16k;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
# 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;
include /etc/nginx/sites-enabled/*.conf;
server {
listen 8080;
server_name host.friendshipcollar.com;
# note that these lines are originally from the "location /" block
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
friendshipcollar.com.conf
server {
listen 80; ## listen for ipv4; this line is default and implied
root /usr/share/nginx/friendshipcollar.com;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name 67.225.176.58 friendshipcollar.com www.friendshipcollar.com;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/friendshipcollar.com;
}
# pass the PHP scripts to PHP-FPM server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$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;
# }
}
I'm trying to figure out why I keep receiving a file not found.
I have a directory with multiple directories within that contain php files in them. I'm not sure how to configure my conf file to execute these files.
I get the following in the error log.
*133 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.17.8.1, server: 172.17.8.101, request: "GET /design_files/tmpls/podcastSilk/L4_index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "172.17.8.101:8001"
The directory structure of the application is as follows
/tmplbuilder
/design_files
/tmpls
/Folder2
L4_index.php
/Folder1
L3_index.php
/public
index.php
Here is my nginx.conf file.
daemon off;
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
client_header_timeout 60;
send_timeout 160;
client_max_body_size 50M;
fastcgi_keep_conn off;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
# 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;
index index.php index.html index.htm ;
server {
listen 80;
server_name 172.17.8.101 192.168.254.96;
root /var/www/tmplbuilder;
#try_files $uri $uri/ /index.php$uri /index.php?$args;
location ~* \.(jpg|jpeg|gif|png|html|htm|css|zip|tgz|gz|rar|doc|xls|pdf|ppt|tar|wav|bmp|rtf|swf|flv|txt|xml|docx|xlsx|js)$ {
try_files $uri $uri/ public$uri public/index.php$uri =404;
access_log off;
expires 30d;
}
location /design_files/ {
root /var/www/tmplbuilder/design_files;
try_files $uri $uri/;
#root /var/www/tmplbuilder/design_files;
#autoindex on;
location ~* \.php$ {
#try_files $uri $uri/ $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/php-fpm.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
#fastcgi_index L4_index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#return 200 $document_root$uri;
}
}
location /public/{
#return 200 $uri;
#alias /var/www/tmplbuilder/public;
root /var/www/tmplbuilder/public;
try_files $uri $uri/ /index.php index.php$uri$args;
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /public/index.php?/$1 last;
break;
}
location ~ \.php$ {
return 200 $uri;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}
}
}
When I run return 200 $document_root$fastcgi_script_name. I get the appropriate path to the file in question. Is this the path nginx can't find? The permissions are 755 on the file.
Try matching the uri in regular expressions ($1) and then feed that as a script name to php-fpm.
location ~ ^(.*\.php)(.*)$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$1;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
So I will start out and say that I am pretty new to web servers and this is my first that I have configured. That being said the webserver is up and running and I can add sites and files to it just fine. However I cannot get any .php files working right now.
I am currently running nginx on FreeBSD and have installed php-fpm. I know that nginx is correctly using php-fpm but for any php file I try and view all I get is "file not found". I know that this is coming from php-fpm because for any file that actually isn't there nginx gives me a different "file not found" page.
I have looked through several google pages about this problem and the most common solution is that it is incorrect permissions on the php file. At this point I can't rule too much out but I have tried changing the permissions for the file and folder including just opening them up to everything with no success.
Here is my nginx.conf file in the hopes that it helps.
user www www;
worker_processes 4;
#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;
index index.html index.htm index.php
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; ## Default: off
sendfile on;
tcp_nopush on;
###custom changes
server_tokens off;
client_max_body_size 200M;
client_body_buffer_size 1M;
port_in_redirect off;
###
keepalive_timeout 15; ## Default: 0
gzip on;
### More custom changes
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6].(?!.*SV1)";
###
server { # simple reverse-proxy
listen 80;
server_name localhost;
#access_log logs/mySite1.access.log;
root /usr/local/www/mySite.com;
location / {
try_files $uri $uri/ /index.php;
}
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { access_log off; log_not_found off; deny all; }
#error_page 404 /404.html;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
}
If anyone has any ideas about what is going on here they would be greatly appreciated.
This might help you out. I use the sockets of FPM, so just change to use the IP like you are but here are my working configurations:
example.com.conf
server {
listen 192.168.1.1:80;
server_name example.com;
charset utf-8;
access_log /vhosts/example.com/logs/access_log main;
error_log /vhosts/example.com/logs/error_log;
index index.php;
root /vhosts/example.com/public;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/usr/local/etc/php-fpm/nginx.sock;
include fastcgi.conf;
}
location ~ \.htaccess {
deny all;
}
}
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;
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;
I don't think you actually have a directory /scripts on your filesystem. You probably mean $document_root/scripts. If you do have a directory /scripts then post the php-fpm log with the SCRIPT_FILENAME logged. I think it's logged by default, but if not the syntax is explained very well in the config file.