下载PHP7
下载nginx
(有可能遇到缺少dll文件,在运行php 的exe时候)下载地址:https://git.oschina.net/bingoPureLife/Some-Files-very-useful/raw/master/vcruntime140.rar
让nginx工作起来:
cd 到nginx根目录 start nginx 但是奇怪的是 nginx -s stop 并不能停掉nginx
我选择了杀进程
tasklist /fi "imagename eq nginx.exe"
找出相关的进程 一一杀掉 taskkill /f /pid xxx || taskkill /f /im nginx.exe
修改一下配置文件让我们的nginx能够处理PHP请求;实际上我们的nginx 不能解释PHP的
error_log logs/error.log error ; pid logs/nginx.pid; worker_processes auto; worker_rlimit_nofile 51200; events { worker_connections 51200; } http { client_body_buffer_size 32k; client_header_buffer_size 2k; client_max_body_size 2m; default_type application/octet-stream; log_not_found off; server_tokens off; include mime.types; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/rss+xml application/xhtml+xml application/atom_xml; gzip_vary on; #error_page 500 502 503 504 /50x.html; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; server { listen 80 default_server; server_name localhost; root apps/www/; index index.php index.html index.htm; location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/; include fastcgi_params; } } include vhost/*.conf; }
然后发现结果处理PHP 请求失败了。fastcgi_pass 127.0.0.1:9000; 从这一句看,我们nginx 直接会把php请求扔这里。然后再php那边调用php解释器
既然我们PHP 请求502错误;timeout;
看看我们的9000端口正常不。
实际上nginx 通过fastcgi 和PHP之间走的是TCP 所以断定;我们的fastcgi 并没有在工作;
(把php根目录下的php.ini-development 改成ini文件)
启动fastcgi
在根目录 php-cgi.exe -b 127.0.0.1:9000-c php.ini
我们在看看端口情况