PHP don';在windows WSL中通过Nginx执行t进程
我正在尝试在windows WSL上使用nginx PHP7.1和mariadb创建一个本地Web服务器。 我尝试了很多东西,使用Kali,使用Debian,使用Ubuntu,更改nginx端口而不是80,我找到了一些我尝试过的nginx配置,但没有一个有效 我的问题是php不能通过nginx进行处理。 当我尝试加载一个简单的php页面时,它会无限加载。 但是当我重新启动php7.1-fpm时,页面工作了!(只有在我试图加载它的情况下) 这是我的实际默认nginx配置文件:PHP don';在windows WSL中通过Nginx执行t进程,php,linux,windows,nginx,Php,Linux,Windows,Nginx,我正在尝试在windows WSL上使用nginx PHP7.1和mariadb创建一个本地Web服务器。 我尝试了很多东西,使用Kali,使用Debian,使用Ubuntu,更改nginx端口而不是80,我找到了一些我尝试过的nginx配置,但没有一个有效 我的问题是php不能通过nginx进行处理。 当我尝试加载一个简单的php页面时,它会无限加载。 但是当我重新启动php7.1-fpm时,页面工作了!(只有在我试图加载它的情况下) 这是我的实际默认nginx配置文件: server {
server {
listen 32000 default_server;
listen [::]:32000 default_server;
# SSL configuration
#
# 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.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# 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.1-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
# I tried this too :
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
当我运行php index.php
时,这也起作用了。但是在firefox上,当我加载这个文件时,什么也没有发生。使用完整的html页面,一切都很好。我得到了nginx欢迎页面也没有问题
我不知道该去哪里找了。感谢阅读,如果你有任何答案,非常感谢 这是我的:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME D:/web/html$fastcgi_script_name;
include fastcgi_params;
try_files = $uri @missing;
}
还要确保PHP-CGI正在运行(并且在正确的端口上) 你好,谢谢!我有两个问题,为什么是9123端口?如何检查php cgi是否正在运行?很抱歉,我不是linux专家,但我正在努力理解!这就是我在上面配置php cgi的端口,通过查看您的任务管理器,如果您使用的是无gui版本的linux,请在终端上使用
ps | aux
,您是对的sudo apt get install php7.1-cli php7.1-fpm php7.1-curl php7.1-gd php7.1-mysql php7.1-mbstring
是我安装php的命令行,我安装了php7.1-cgi,但它没有出现在ps-aux
中。因为apt get install不启动进程,它只是下载php7包