Take the 2-minute tour ×

I'm running nginx on EC2, with the goal of setting up phabricator. This is my nginx.conf file:

# For more information on configuration, see:

user  eng;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

# for more information.
include /etc/nginx/conf.d/*.conf;

include /etc/nginx/sites-enabled/*;


This is conf.d:

 " Netrw Directory Listing                                        (netrw v134)
 "   /etc/nginx/conf.d
 "   Sorted by      name
 "   Sort sequence: [\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$

In my sites-enabled, I have a symlink to a configuration, phabricator.mysite.com, which is located in sites-available. Here are the contents of phabricator.mysite.com:

 ## Phabricator
server {
    listen       80;
    server_name  phabricator.mysite.com;

    root   /home/eng/phabricator/phabricator/webroot;
    try_files $uri $uri/ /index.php;

    location / {
        index  index.php;
        if ( !-f $request_filename )
            rewrite ^/(.*)$ /index.php?__path__=/$1 last;

    location /index.php {
        fastcgi_pass   localhost:9000;
        fastcgi_index   index.php;

        fastcgi_param  REDIRECT_STATUS    200;

        #variables to make the $_SERVER populate in PHP
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;

        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

        fastcgi_param  REMOTE_ADDR        $remote_addr;

When I try to access phabricator.mysite.com, I get the following error in my nginx error log:

2013/08/29 04:12:52 [error] 30977#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:, server: phabricator.mysite.com, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: "phabricator.mysite.com"

THe permissions for my webroot folder are set to 755.

What am I doing wrong?

share|improve this question
What research have you done? From what I've seen it may be related to a wrongly set SCRIPT_FILENAME in the nginx fastcgi_param directive. –  Drew Khoury Aug 29 '13 at 4:44
I've been Googling around for several hours. The fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; comes from the config at phabricator.com/docs/phabricator/article/… . It may be wrong. Where would I find the values being assigned to these variables? I know that $document_root is set in the root directive--which is correct (If I put an html file in my root folder I can access it no problem). Where can I find the value of $fastcgi_script_name? –  Catherine Aug 29 '13 at 4:53
It think you should add the relevant information in your questions, so people answering it can do a good job. –  Drew Khoury Aug 29 '13 at 4:55
What information am I missing that I can provide? I'd be more than happy to, I'm just not sure what I'm missing. –  Catherine Aug 29 '13 at 4:57
Everything you said in your comment. I'm just pointing out that this information is valuable and probably worth throwing in the question in the fist place. –  Drew Khoury Aug 29 '13 at 5:01
show 2 more comments

1 Answer

add following line after, "location /index.php {" in location section

root /home/eng/phabricator/phabricator/webroot;

share|improve this answer
Nope, that's not it. PHP FPM is running. Calling netstat -lpn shows, among other things: tcp 0 0* LISTEN 25141/php-fpm –  Catherine Aug 29 '13 at 5:12
Exact same problem. –  Catherine Aug 29 '13 at 5:26
add comment

Your Answer


