NGINX PHP脚本下载而不是执行
我正在运行NGINX,当我运行PHP脚本domain.com/script.PHP时,它会下载而不是执行。 我正在运行PHP版本:7.3.24,Zend Engine v3.3.24,nginx版本:nginx/1.16.1 我到处都找遍了,试遍了所有看起来的东西,但我就是无法让它发挥作用。我还尝试过清除浏览器中的catch,重新启动服务器,以及NGINX PHP脚本下载而不是执行,php,nginx,Php,Nginx,我正在运行NGINX,当我运行PHP脚本domain.com/script.PHP时,它会下载而不是执行。 我正在运行PHP版本:7.3.24,Zend Engine v3.3.24,nginx版本:nginx/1.16.1 我到处都找遍了,试遍了所有看起来的东西,但我就是无法让它发挥作用。我还尝试过清除浏览器中的catch,重新启动服务器,以及sudo服务nginx-reload和sudo服务php-fpm-restart 运行HTML文件工作正常。问题只存在于php文件中 我的日志文件显示:
sudo服务nginx-reload
和sudo服务php-fpm-restart
运行HTML文件工作正常。问题只存在于php文件中
我的日志文件显示:
*39 connect()连接到上游时失败(111:连接被拒绝),客户端:[IP],服务器:[DOMAIN].com,请求:“GET/phpinfo.php HTTP/1.1”,上游:fastcgi://127.0.0.1:9000,主机:“[DOMAIN].com”
从命令行运行sudo服务php fpm start
,没有创建.sock文件。所以我选择了listen=127.0.0.1:9000
这是我的/etc/php-fpm.d/www.conf
[www]
user = nginx
group = nginx
listen = 127.0.0.1:9000
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache
这是我的/etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
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 1;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80 default_server;
server_name [DOMAIN].com;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
root /var/www;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}