Jump to content

php-cgi and nginx


Recommended Posts

Okay, I've (tried) to set up php with nginx, and php-cgi.exe is on the right port, but i get this error whether i load index.php (a page that exists) or bad.php (a page that doesn't exist)

I've tried it without php-cgi running, or it running on the wrong port, and It loads forever than gives a "this page is temporarly unavaliable" error.

 

I've been working at this for hours, please help!

 

here is my nginx.conf file:

 

#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   /nginx/html;
            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           html;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME  /nginx/html$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;
    #    }
    #}

}

and here is my error log:

2010/05/08 17:15:43 [error] 1996#1544: *1 CreateFile() "C:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost"
2010/05/08 19:34:14 [error] 5916#4752: *18 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 connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
2010/05/08 19:35:30 [emerg] 3100#3544: unknown directive "proxy" in C:\WEMP\nginx/conf/nginx.conf:59
2010/05/08 19:36:37 [emerg] 6816#4544: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59
2010/05/08 19:36:37 [alert] 6348#6532: worker process 6816 exited with code 1
2010/05/08 19:36:37 [alert] 6348#6532: can not respawn worker
2010/05/08 19:37:21 [emerg] 3488#4400: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59
2010/05/09 09:10:14 [emerg] 2444#3780: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59
2010/05/09 16:45:21 [emerg] 6548#5724: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
2010/05/09 17:11:27 [error] 1760#5020: *3 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 connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
2010/05/09 17:24:10 [error] 1960#2852: *3 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 connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /bad.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:10000", host: "localhost"
2010/05/09 17:25:19 [error] 1960#2852: *8 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 connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:10000", host: "localhost"

 

I tried to change the port on php-cgi, but that didn't work so i canged it back. I'm calling the folder i've put it in WEMP (windows, engine x, mysql, php) because i'm going to get it all together and package it so anyone can use it if they want.

 

I really need to get this worked out soon. I've got Apache and iis7 on this computer (I'm sure they're not interfering) and i have never had such a problem with them.

 

basically this is going to be used as a test server.

 

Thanks in advance (I hope i have a reason to thank later),

Ilovetopk

 

Link to comment
Share on other sites

I was fiddling around with nginx the other night, so this thread caught my attention.

 

Anyway, I just duplicated your setup, and I was confused for quite a while.  File permissions....  You need to make sure whatever user you're running php-cgi under has read access to c:\wemp.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.