OpenVBX icon indicating copy to clipboard operation
OpenVBX copied to clipboard

Error "An application error occurred. Please try again." on nginx

Open jpsim opened this issue 13 years ago • 8 comments
trafficstars

From the initial install screen, I'm getting error "An application error occurred. Please try again."

Running Ubuntu 10.04.4, PHP 5.3.14-1, nginx 0.7.65.

All boxes on Install are green except Apache (optional).

My error.log looks like this:

2012/06/29 18:04:17 [error] 1430#0: *22 open() "/srv/www/vbx.example.com/public_html/index.php/install" failed (20: Not a directory), client: 206.248.139.39, server: vbx.example.com, request: "GET /index.php/install HTTP/1.1", host: "vbx.example.com"

Firebug shows me this:

GET http://vbx.example.com/support/rewrite/index.php
404 Not Found
41ms
?g=installjs (line 16)

POST http://vbx.example.com/index.php/index.php/install/validate
404 Not Found
43ms
?g=installjs (line 16)

My nginx config file looks like this:

server {
    listen   80;
    server_name vbx.example.com;
    access_log /srv/www/vbx.example.com/logs/access.log;
    error_log /srv/www/vbx.example.com/logs/error.log;

    location / {
        root   /srv/www/vbx.example.com/public_html;
        index  index.php;

        if (-f $request_filename) {
           break;
        }

        if (-d $request_filename) {
           break;
        }
        rewrite  ^(.*)$  /index.php?vbxsite=$1  last;
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        proxy_pass_header Set-Cookie;
        fastcgi_pass_header Set-Cookie;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME /srv/www/vbx.example.com/public_html/$fastcgi_script_name;
    }
}

It seems to be an nginx rewrite issue but I can't decipher any more than that. Anyone have any ideas?

Thanks!

jpsim avatar Jun 29 '12 22:06 jpsim

jpsim,

I've been playing around with this and the issue might be requests for favicons & robots.txt being routed to OpenVBX.

Try adding this to your nginx config:

location /(favicon.ico|robots.txt) {
    access_log off; 
    log_not_found off;
    error_page 404 /404;
    expires   30d;
    add_header Cache-Control public;
}

Gipetto avatar Jul 02 '12 16:07 Gipetto

I was able to get through the install process by changing the OpenVBX.home variable to the proper address (it was showing up as http://myserveraddress.com/index.php/index.php)

Now I can't login. It continues to log me out and with @Gipetto's new config attempts gives me a 404 with the auth/login?redirect url. I've tried using all of the nginx config files I can find. I'm going to try digging into this a little deeper later.

bjtitus avatar Jul 22 '12 17:07 bjtitus

Changing OpenVBX.home to actual URI allowed me to complete install and I am able to log in and use OpenVBX normally. Thanks for the hint, bjtitus!

turyn avatar Sep 01 '12 02:09 turyn

Just in case someone else finds this thread, I found that if I changed the config.php file, specifically this line $config['index_page'] = 'index.php'; to$config['index_page'] = ''; My issue was solved. This is because the rewrite was already setup. If you have index.php in that config entry it will duplicate it on the OpenVBX.home variable in JS.

davismwfl avatar Nov 06 '12 18:11 davismwfl

add this to your php block...

fastcgi_split_path_info ^(.+.php)(.+)$;

fastcgi_param PATH_INFO $fastcgi_path_info;

oojacoboo avatar Nov 26 '12 03:11 oojacoboo

@davismwfl Thank you, that worked for me too.

ringe avatar Sep 30 '13 20:09 ringe

/OpenVBX/config/config.php

$config['index_page'] = '';

Nginx server:

Put the following directly ABOVE php directive.

Example:

location / {
    index  index.php;   
    if (!-e $request_filename){
    rewrite ^/(.*) /index.php?vbxsite=$1;
    }
}

location ~ \.php$ {
#do typical php-fpm stuff

}

ideeliah avatar Jul 31 '15 01:07 ideeliah

htaccess to nginx converter http://winginx.com/en/htaccess

ideeliah avatar Jul 31 '15 01:07 ideeliah