php项目中出现 upstream: “fastcgi://unix:/var/run/php-cgi.sock“,

本文介绍了一种常见的Nginx问题——404 Not Found错误,并提供了具体的解决方案。当遇到此问题时,检查错误日志可以发现与fastcgi连接相关的问题,通过重启php-fpm服务通常能够有效解决该问题。

项目中出现nginx 404 not found.

查看error.log后发现 "fastcgi://unix:/var/run/php-cgi.sock",

出现这种情况时,重启一下php-fpm即可解决问题。

## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # #server { # listen 80; # listen [::]:80; # server_name jenkins.eftong.cn; # return 301 https://$server_name$request_uri; #} #server { # SSL configuration # # listen [::]:443 ssl ipv6only=on; # managed by Certbot # listen 443 ssl; # managed by Certbot # ssl_certificate /etc/ssl/certs/4177192_jenkins.eftong.cn.pem; # ssl_certificate_key /etc/ssl/certs/4177192_jenkins.eftong.cn.key; # access_log /var/log/nginx/jenkins.access.log; # error_log /var/log/nginx/jenkins.error.log; # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; # root /var/www/html; # Add index.php to the list if you are using PHP # index index.html index.htm index.nginx-debian.html; # server_name jenkins.eftong.cn; # location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. #try_files $uri $uri/ =404; # include /etc/nginx/proxy_params; # proxy_pass http://localhost:8888; # proxy_read_timeout 90s; # Fix potential "It appears that your reverse proxy setup is broken" error. # proxy_redirect http://localhost:8888 https://jenkins.eftong.cn; # } # pass PHP scripts to FastCGI server # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} #} server { listen 8304; server_name 11.21.1.120; location ^~ /WEB-INF { deny all; } location / { root /home/hcare/support/application/EFT-P9/frontend/client/html; index index.html index.htm; try_files $uri $uri/ /index.html; } location ^~ /auth/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /operator/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /service/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /his/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /static/ { root /home/hcare/support/application/EFT-P9/frontend/client/html; } location ~ .*\.(gif|jpg|jpeg|png)$ { expires 24h; root /data/EFT-P9/pic/;#指定图片存放路径 #access_log /usr/local/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /data/EFT-P9/pic/;#图片访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } location ~ .*\.(txt|pdf|doc|docx|xls|xlsx)$ { expires 24h; root /data/EFT-P9/file/;#指定图片存放路径 #access_log /usr/local/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /data/EFT-P9/file/;#访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } error_page 404 = http://11.21.1.120:8304/#/404; } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #}
09-05
server { listen 80; listen 443 ssl http2 ; server_name jiujie.com www.jiujie.com; index index.php index.html index.htm default.php default.htm default.html; root /www/wwwroot/jiujie.com; #CERT-APPLY-CHECK--START # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除 include /www/server/panel/vhost/nginx/well-known/jiujie.com.conf; #CERT-APPLY-CHECK--END #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则 #error_page 404/404.html; #HTTP_TO_HTTPS_START if ($server_port !~ 443){ rewrite ^(/.*)$ https://$host$1 permanent; } #HTTP_TO_HTTPS_END ssl_certificate /www/server/panel/vhost/cert/jiujie.com/fullchain.pem; ssl_certificate_key /www/server/panel/vhost/cert/jiujie.com/privkey.pem; ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; add_header Strict-Transport-Security "max-age=31536000"; error_page 497 https://$host$request_uri; #SSL-END #ERROR-PAGE-START 错误页配置,可以注释、删除或修改 #error_page 404 /404.html; #error_page 502 /502.html; #ERROR-PAGE-END #PHP-INFO-START PHP引用配置,可以注释或修改 include enable-php-54.conf; #PHP-INFO-END #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效 include /www/server/panel/vhost/rewrite/jiujie.com.conf; #REWRITE-END #禁止访问的文件或目录 location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) { return 404; } #一键申请SSL证书验证目录相关设置 location ~ \.well-known{ allow all; } #禁止在证书验证目录放入敏感文件 if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) { return 403; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log /dev/null; access_log /dev/null; } location ~ .*\.(js|css)?$ { expires 12h; error_log /dev/null; access_log /dev/null; } access_log /www/wwwlogs/jiujie.com.log; error_log /www/wwwlogs/jiujie.com.error.log; }
最新发布
12-03
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

芝麻开门2015

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值