PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : مشکل FastCGI sent in stderr: "Primary script unknown" در nginx



N3td3vil
July 26th, 2015, 11:25
با سلام
دوستان من روی یه وی پی اس nginx نصب کردم ، منتهی فایل هایی که توی روت دایرکتوری ریختم رو روی بروزر اجرا نمیکنه و ارور not found میده
سیستم عامل centos هست .
کانفیگ هاست nginx :

server {
listen 80;

index index.php;
server_name www.domain.ir domain.ir;

access_log /var/log/nginx/domain.ir-access.log;
root /website/user;
error_log /var/log/nginx/domain.ir-error.log;
error_page 404 /search404;

add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'";
server_tokens off;

## All other errors get the generic error page
## error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
location /search404 {
internal;
}

location / {
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;

location = /robots.txt {
access_log off;
log_not_found off;

try_files $uri @drupal;
}

location ~* ^.*(\.(?:engine|inc|info|install|make|module|profi le|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base|txt|htaccess)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|a ll-wcprops|entries|format))$ {
deny all;
error_page 403 =404;
}

try_files $uri @drupal;
expires 10m;
}

location @drupal {
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;

set $user_flag "";

if ($http_x_forwarded_proto != https) {
set $user_flag "${user_flag}A";
}



if ($remote_addr !~ ^(ips)) {
set $user_flag "${user_flag}C";
}

if ($user_flag ~ BC) {
rewrite ^/(.*) http://$host:80 last;
break;
}

if ($user_flag = AB) {
# rewrite ^/(.*) https://$host$uri break;
# break;
}

set $user_flag "";


if ($http_x_forwarded_proto = https) {
set $user_flag "${user_flag}M";
}



if ($http_cookie ~ SESS) {
set $user_flag "${user_flag}O";
}

if ($http_cookie !~ SESS) {
set $user_flag "${user_flag}P";
}



if ($user_flag ~ MNQ) {
rewrite ^/(.*) http://$host$uri break;
break;
}

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location ~ ^/(install|cron|update).php$ {
allow ips;
allow ips;
error_page 403 =404;
expires off;
root /website/user/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
deny all;
}
# php file handling
location ~ .php$ {
root /website/user/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}


یه فایل phptest.conf هم گذاشتم با تنظیمات زیر :

server {
listen 80; # listen port
server_name 192.168.80.3; # Server name (www.krizna.com)
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://assets.zendesk.com; font-src 'self' https://themes.googleusercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'";
server_tokens off;

location / {
root /usr/share/nginx/html; # Document root
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html; # Document root
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}


تو دایرکتوری بالا فایل phpinfo رو لود میکنه ، مشکل کانفیگ کجاست ؟
توی ارور لاگ هم مورد زیر مشاهده میشه :
2015/07/26 10:32:24 [error] 4456#0: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:
راه حل چیه ؟ کسی از دوستان به این مشکل خورده تاحالا ؟
ممنون

web2iran.ir
July 27th, 2015, 12:19
./build set webserver nginx
./build set php1_mode php–fpm
./build update
./build all d
./build rewrite_confs

N3td3vil
August 8th, 2015, 13:42
./build set webserver nginx
./build set php1_mode php–fpm
./build update
./build all d
./build rewrite_confs

سلام عزیز این دستوراتی که شما میگی واسه دایرکت ادمین هست .
دوستانی که این مشکل رو دارند راه حلش کانفیگ صحیح selinux هست و بس
مرسی به هر حال که تاپیکو خوندین