[solved] Codeigniter - Freelancer Office - Database not being populated


#1

Hello all!

I recently bought a tool on CodeCanyon called Freelancer Office (by gitbench).

In their docs it is stated to configure nginx like this:

server {
	listen X.X.X.X:443 ssl http2;
	ssl_protocols TLSv1.2;
	ssl_certificate cert.pem;
	ssl_certificate_key privkey.pem;
	server_name domain.com;
	root   /var/www/domain.com;
	autoindex on;
	index index.php;
	location / {
		try_files $uri $uri/ /index.php;
		location = /index.php {
			fastcgi_pass unix:/var/lib/php5-fpm/web.sock;
			fastcgi_param  SCRIPT_FILENAME /var/www/domain.com$fastcgi_script_name;
			include /etc/nginx/fastcgi_params;
			fastcgi_index index.php;
		}
	}
	location ~ \.php$ {
		return 444;
	}
	# set expiration of assets to MAX for caching
	location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
		expires max;
		log_not_found off;
	}
}

Where is this code best put or how is it best integrated for an easyengine site that was created using:

ee site create mydomain.com --mysql

I am using nginx mainline with http/2.

So far I integrated it like so, but I am not entirely sure if this is correct! Please shed some light on the issue:

  1. I added a new file called phptool.conf in /etc/nginx/common/ it contains following code:
location / {
        # Check if a file exists, or route it to index.php.
        try_files $uri $uri/ /index.php;
    		location = /index.php {
			fastcgi_pass php;
			fastcgi_param  SCRIPT_FILENAME /var/www/mydomain.com$fastcgi_script_name;
			include /etc/nginx/fastcgi_params;
			fastcgi_index index.php;
			}
}

	location ~ \.php$ {
		return 444;
	}

  1. The I modified /etc/nginx/sites-available/mydomain.com like so:
server {

	listen 80;
    server_name mydomain.com www.mydomain.com;
    rewrite ^/(.*) https://mydomain.com/$1 permanent;
}

server {
   listen 443 ssl http2;

    server_name mydomain.com   www.mydomain.com;

    access_log /var/log/nginx/mydomain.com.access.log rt_cache; 
    error_log /var/log/nginx/mydomain.com.error.log;

	ssl_certificate /var/www/mydomain.com/conf/ssl/mydomain.com.crt;
	ssl_certificate_key /var/www/mydomain.com/conf/ssl/mydomain.com.key;

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
	ssl_dhparam /path/to/my/dhparams.pem;
	ssl_buffer_size 8k;
	ssl_stapling on;
	ssl_stapling_verify on;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    resolver_timeout 10s;
	ssl_trusted_certificate /path/to/my/cert;

	proxy_ssl_session_reuse off;
    
    add_header Alternate-Protocol  443:npn-http2/3;
	add_header Strict-Transport-Security max-age=31536000;

    root /var/www/mydomain.com/htdocs;
    
    

    index index.html index.php;


    include common/phptool.conf;  
    
    
    include common/locations.conf;
    include /var/www/mydomain.com/conf/nginx/*.conf;
}
  1. Then I ran service nginx restart successfully. The installer routine is working fine until…

  2. Furthermore, I am receiving a database error once the first installation steps are finished. When I look into the database via phpmyadmin, the db is empty. No tables have been set up or populated. Does any of you know this tool and have an idea how to set it up correctly with MariaDB?

The database.php in the codeigniter part of the tool show mysqli as dbdriver… so it should work. All db connection data is correct I believe:

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'mydbusername as shown in ee-config.php';
$db['default']['password'] = 'mydbpassword';
$db['default']['database'] = 'mydbname';

/** Do not change the below values. Change only if you know what you are doing */
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = 'fx_';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_unicode_ci";
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
$active_group = 'default';
$active_record = TRUE;

Hm… help is greatly appreciated!

Thanks!


#2

Ok I got it to work!

One needs to do the installation manually.

So far my setting were correct. At least I am not experiencing any issues so far. Will update above settings if I run into anything that needs adjustment.

Here is what needs to be done after setting up your nginx rewrite and conf files:

https://gitbench.com/documentation/install.php#manual_install

Simply follow the instructions step-by-step . Works like a charm!

@Prabuddha
Please do not close this thread, in case anyone needs help. Then I can answer here. Thanks!


#3