"Primary script unknown" while reading response header from upstream, client: 192.168.1.102, server:
2017-07-13 13:22
543 查看
配置好了nginx和php,结果访问报这个错,经排查,是我的默认nginx配置文件解析php那里没有写root,我之前以为只要上面写有就可以,因此把php那里删掉了。
贴一下正确的配置文件:
nginx.conf
贴一下正确的配置文件:
default.conf
server { listen 80; server_name localhost 192.168.1.100; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.php index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
nginx.conf
[root@minimal my.cnf.d]# cat /etc/nginx/nginx.conf user www-data www-data; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; 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"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; }
相关文章推荐
- 配置LNMP环境出现错误:Primary script unknown" while reading response header from upstream
- 关于FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream的一次解决过
- Nginx" upstream prematurely closed connection while reading response header from upstream"问题排查
- failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x
- FastCGI sent in stderr: "Primary script unknown" while reading response head
- 修复Nginx 502错误:upstream sent too big header while reading response header from upstream
- php-fpm upstream sent too big header while reading response header from upstream
- nginx 错误502 upstream sent too big header while reading response header from upstream
- 错误502 upstream sent too big header while reading response header from upstream
- 1345#0: *640 upstream sent too big header while reading response header from upstream
- recv() failed (104: Connection reset by peer) while reading response header from upstream
- Nginx 错误502 upstream sent too big header while reading response header from upstream
- nginx 错误502 upstream sent too big header while reading response header from upstream
- upstream timed out (110: Connection timed out) while reading response header from upstream 问题解决
- upstream sent invalid header while reading response header from upstream 错误解决
- recv() failed (104: Connection reset by peer) while reading response header from upstream
- php502问题解决:recv() failed (104: Connection reset by peer) while reading response header from upstream
- 修复upstream sent too big header while reading response header from upstream
- nginx upstream timed out (110: Connection timed out) while reading response header from upstream
- recv() failed (104: Connection reset by peer) while reading response header from upstream