1

I have setup WNMP on Windows Server 2012 despite the fact that it's not that great of a setup it's required, here are my settings:

worker_processes  1;

error_log  logs/error.log;
#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    fastcgi_read_timeout 2m;
    fastcgi_ignore_client_abort on;
    include       mime.types;
    default_type  application/octet-stream;

    access_log  off;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
        ssl_ciphers ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH; 
        ssl_prefer_server_ciphers on;
    #gzip  on;
    # http server
server {
    listen   80;
    listen   [::]:80;

    server_name www.localserver.com;

    return 301 https://$server_name$request_uri;
} # end http server

# https server
server {
    listen 443 default ssl;
    server_name www.localserver.com;
    ssl_certificate      localserver.com.crt;
    ssl_certificate_key  www.localserver.com.key;

    ## Parameterization using hostname of access and log filenames.
    access_log off;
    error_log logs/localhost_error.log;

    ## Root and index files.
    root html;
    index  index.php index.html index.htm;

    ## If no favicon exists return a 204 (no content error).
    location = /favicon.ico {
        try_files $uri =204;
        log_not_found off;
        access_log off;
    }

    ## Don't log robots.txt requests.
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    ## Try the requested URI as files before handling it to PHP.
    location / {

        ## Regular PHP processing.
        location ~ \.php$ {
            root           C:/Wnmp/html;
        #try_files  $uri =404;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME    C:/Wnmp/html$fastcgi_script_name;
            include        fastcgi_params;
        }

        ## Static files are served directly.
        location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
            expires max;
            log_not_found off;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
            ## Set the OS file cache.
            open_file_cache max=1000 inactive=120s;
            open_file_cache_valid 45s;
            open_file_cache_min_uses 2;
            open_file_cache_errors off;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one

        location ~ /\.ht {
            deny  all;
        }

        ## Keep a tab on the 'big' static files.
        location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
            expires 30d;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
        }
        } # / location
} # end https server
}

Here are my errors, the error.log is flooded with them:

2013/08/17 16:44:58 [error] 3808#3704: *1546926 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading response header from upstream, client: my.ip.is.here, server: www.localserver.com, request: "GET /script.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.localserver.com", referrer: "https://www.localserver.com/otherscript.php"
2013/08/17 16:44:59 [error] 3808#3704: *1544098 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: my.ip.is.here, server: www.localserver.com, request: "GET /script.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.localserver.com", referrer: "https://www.localserver.com/otherscript.php"

Seems that everything works but stops responding after some time.

3
  • This probably isn't the cause of the problem, but nginx.org lists root directives in location blocks as a common pitfall.
    – Paul
    Aug 17, 2013 at 17:13
  • 1
    Your logs show that php-fpm died unexpectedly and began failing to respond. You should check its (separate) logs. And, again, don't do this on Windows. Aug 17, 2013 at 19:58
  • I am using php-cgi which apparently has php-fpm built in, I have no choice but to use Windows sadly. There are no errors there.
    – Max Smith
    Aug 18, 2013 at 0:09

0

You must log in to answer this question.

Browse other questions tagged .