Page 1 of 1

How to install and use Arrowchat on an nginx only server?

PostPosted: 11 Jul 2023, 06:13
by zoldos
I'm using Ubuntu 20.04 with a strictly nginx server. After some research, I'm to understand that I need the re-write codes stored in Arrowchat's .htaccess file converted to nginx directives. Can anyone assist? I tried several times and always failed since I'm already using a var in the directive to re-write my site which apparently can't be used twice, but there may be a workaround.

Thoughts or ideas are most appreciated!

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 11 Jul 2023, 06:56
by Jason
What’s the issue you’re having? It’s not common to have issues with nginx.

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 16 Jul 2023, 15:39
by zoldos
What’s the issue you’re having? It’s not common to have issues with nginx.
My apologies, I didn't get a notification of this reply.

Basically, I'm running a nginx only Ubuntu 20.04/PHP 8.2.8 server with Apache turned off. I needed to add some back end nginx directives so my Xenforo 2.2 forum would re-write correctly. But this also means that .htaccess can't be used (I'm assuming). Arrowchat 4 seems to use .htaccess, so I was trying to figure out how to get it to work by adding more nginx directives. But with, or without .htaccess, it doesn't seem to work at all, user side. I even turned Apache back on and restored the .htaccess files.

It installs perfectly, and I can access the admin panel without issue. Very strange!

Any ideas?

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 16 Jul 2023, 17:33
by Jason
What part isn't working?

ArrowChat doesn't actually require an htaccess file to run; it only makes things more user friendly.

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 17 Jul 2023, 10:57
by zoldos
What part isn't working?

ArrowChat doesn't actually require an htaccess file to run; it only makes things more user friendly.
The install process works, the Arrowchat admin is perfect, and I added the code to my Xenforo "PAGE.CONTAINER" template. But when I load my forum, it doesn't show up. It is set to member's only, and everyone chats with everyone. But I simply don't see the chat bubble.

I'll install it again and see about enabling errors and inspect it, etc.

I'll get back to you. Thanks!

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 17 Jul 2023, 11:38
by Jason
That's probably because you are using non-standard sessions in Xenoforo, perhaps Memcached.

If you are using memcached with XenForo, here is the get_user_id() function:
Code: Select all
    function get_user_id()
    {
        global $db;
        
        $userid = NULL;
        
        $m = new Memcached();
        $m->addServer('127.0.0.1', 11211);

        if (!empty($_COOKIE['xf_session']))
        {   
            $session = $m->get('xf_session_' . $_COOKIE['xf_session']);
            
            if (!empty($session))
            {
                $data = unserialize($session[0]);
                $data = unserialize($data);
                $userid = $data['user_id'];
                
                if (!empty($userid))
                {
                    $result = $db->execute("
                        SELECT is_banned, user_state
                        FROM " . TABLE_PREFIX . DB_USERTABLE . "
                        WHERE " . DB_USERTABLE_USERID . " = '" . $userid . "'
                    ");
                    
                    if ($row = $db->fetch_array($result))
                    {
                        if ($row['is_banned'] == 1 OR $row['user_state'] == 'email_confirm' OR $row['user_state'] == 'moderated' OR $data['isIpBanned']['result'] == true)
                        {
                            $userid = NULL;
                        }
                    }
                }
            }
        }

        return $userid;
    }
You just need to replace this with your get_user_id() function in the includes/integration.php file.

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 18 Jul 2023, 12:52
by zoldos
Ah! Fixed! I was caching sessions. I removed that from my Xenforo config, and the chat came right up. Thank you very much!!! I've been having this issue for literally months.

:)

Re: How to install and use Arrowchat on an nginx only server?

PostPosted: 30 Sep 2023, 10:03
by zaja
The same issue on nginx server, the chat icon appears only if I turn off Redis cashing in the xenforo config file:
Code: Select all
$config['cache']['enabled'] = false;
$config['cache']['sessions'] = false;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
Any workarounds to leave Redis caching enabled and chat that work?
Thanks