在 Windows 上安装 nginx + php + mysql

在 Windows 上安装 nginx + php + mysql

我正在使用此链接安装 wnmp

http://github.com/Xeoncross/wnmp

我已按照说明进行操作,但收到这是我从 nginx 错误日志中收到的错误。

日志

1 upstream sent unsupported FastCGI protocol version: 70 while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"

这是我的文件夹

- wnmp
  - memcached
  - mysql
  - nginx
  - php
  - www

我的 nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   ../www;
            index  index index.html index.htm index.php;
        }

        #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   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           ../www;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  ../www$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

顺便说一下这是 start.bat

@ECHO OFF

REM Windows The following is not valid  
REM set PHP_FCGI_CHILDREN=5

REM  Each process handles the maximum number of requests, or is set to Windows Environment variables  
set PHP_FCGI_MAX_REQUESTS=1000

:: Start PHP-fastcgi on port 9000
RunHiddenConsole php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini

:: Start MySQL using the mysql\my.ini config file
start mysql\bin\mysqld

:: Start Memcached (m = memory to use in MB, c = max connections allowed)
RunHiddenConsole memcached\memcached.exe -m 10 -c 1024

:: Start the nginx server
cd nginx
start nginx

EXIT

如果你有什么需要请评论

感谢您的关注

亚当·拉马丹

答案1

我也遇到过这个问题。当我启动 php-cgi.exe 时,发现另一个应用程序已经在监听端口 9000。php-cgi.exe 似乎没有报告此问题。

在我的情况下,不管你信不信,监听 9000 端口的是“E Text-Editor”。我通过运行(在 Win7 上提升权限)发现了这一点:

网络状态监测-a-b-n

(可执行监听显示在端口行之后)

因此,终止其他应用程序可以解决问题,而更改端口号是一个更长期的解决方案:) 无论如何,对我来说!

相关内容