1

I'm trying to set up various facilities laravel applications on my nginx server hhvm, but after much research and many attempts could not succeed.

Could someone help me with this? Here is my current setup:

server {
        listen      80;
        server_name  178.13.1.230;
        root    /home/callcenter/public_html/gateway;

        location /  {
            index   index.html index.php;
        }

        location /crm    {
            root   /home/callcenter/public_html/gateway/crm/public;
            #rewrite ^/crm/(.*)$  /$1  break;
            index   index.php   index.html;
            try_files   $uri  $uri/ /index.php$is_args$args /index.php?$query_string;
        }

        location ~ /crm/.+\.php$ {
            root   /home/callcenter/public_html/gateway/crm/public;
            #rewrite ^/crm/(.*)$  /$1  break;
            include /etc/nginx/fastcgi.conf;
            fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;

            fastcgi_index  index.php;
            include /etc/nginx/hhvm;
            #fastcgi_pass unix:/var/run/hhvm/hhvm.sock;

        }

    }

EDIT

Excuse my lack of attention, really did not let explained the problem right.

The server is reacting as if I was trying to make a "direct download" a file when I access 178.13.1.230/crm

What I need is that I can set up multiple laravel applications on the same server, accessing them in urls like:

http://178.13.1.230/app1

http://178.13.1.230/app2

The fastcgi line is commented, is being replaced by the hhvm.conf include.

Thank you for your help!

Below is a copy of the files that are on include:

/etc/nginx/hhvm.conf

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}


location ~ /crm/.+\.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

/etc/nginx/fastcgi.conf

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  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

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

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

1 Answers1

0

There is not much information in your question (about what doesn't "work" exactly: what would you expect and doesn't happen? Also, two files are included and you don't show their content).

Anyway, I wouldn't expect this configuration to work (at least not the php files) since you're not passing anything to php-fpm (or hhvm), the matching line is commented out.

Now I wouldn't expect this configuration to work because you show /etc/nginx/hhvm.conf but include /etc/nginx/hhvm (is it a typo?).

Also, you use /etc/nginx/fastcgi.conf but /etc/nginx/hhvm.conf includes a fastcgi_params file. This looks complicated, but maybe it's intentional? Do you have a fastcgi_params file that defines correct parameters?

Finally, I would include the hhvm.conf in the server block, not inside a location block.

So I would try this:

server {
        listen      80;
        server_name  178.13.1.230;
        root    /home/callcenter/public_html/gateway;

        location /  {
            index   index.html index.php;
        }

        location /crm    {
            root   /home/callcenter/public_html/gateway/crm/public;
            index   index.php   index.html;
            try_files   $uri  $uri/ /index.php$is_args$args /index.php?$query_string;
        }

        include /etc/nginx/hhvm.conf;

        }

    }

But if you have no fastcgi_params file, it won't work. (I'd probably use only one fastcgi_params file: rename fastcgi.conf in fastcgi_params or vice-versa).

I guess you made sure hhvm is running, listening on the socket you've defined, and is running fine.

zezollo
  • 430
  • 1
  • 4
  • 10