Elgg usage with Apache and proxy_fcgi_module

I am completely new with installing Elgg and change configurations.

I needed to change my server configuration, we switched from Apache php_module to php-fpm and proxy_fcgi_module.

Now our elgg is completely broken. Here is my Apache (v 2.4.53) config

 

# actually main wordpress site, community and collaboration are in /var/www/html

<VirtualHost *:443>

DocumentRoot "/var/www/html/"

ServerName co2-avatar.com

ServerAlias sustainable-data-platform.de


Header always set Access-Control-Allow-Origin "*"

Header always set Access-Control-Max-Age "5600"

Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"


# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1.

DirectoryIndex index.php

<FilesMatch "\.php$>

SetHandler proxy:fcgi://localhost:9000 

</FilesMatch>


<Directory "/var/www/html/">

CGIPassAuth On

Options Indexes FollowSymLinks

AllowOverride All

Require all granted

</Directory>


# ssl, logging

</VirtualHost>

I see different errors: one is for CORS when I try to login

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sustainable-data-platform.de/community/action/login. (Reason: CORS request external redirect not allowed).


Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sustainable-data-platform.de/community/action/login. (Reason: CORS preflight response did not succeed). Status code: 302.


Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sustainable-data-platform.de/community/action/login. (Reason: CORS request did not succeed). Status code: (null).
 
How can I change my proxy setup for making OPTIONS and POST possible again?
 
Another one looks like this, does anybody know what that could mean?
 
Es ist ein nicht behebbarer Fehler aufgetreten. Der Fehler wurde protokolliert. Wenn Du der Seitenadministrator bist, prüfe bitte die Konfiguration in elgg-config/settings.php. Andernfalls leite bitte folgende Informationen an den Seitenadministrator weiter:
  • I'm not an expert in Apache but in Nginx.

    (Any reason why you still use Apache?)

    Just found some guides that can help you: 1, 2

    Another tutorial was Google translated from Ukrainian to English.

     

    Can you clarify what 'elgg is completely broken' means? Any HTTP error codes e.g. 404, 500, 503...?

    Which your OS?

    Elgg version?

     

    Regarding to CORS issues please learn 1, 2

    You can google it as well.

     

    Also, I can't see your attached image because this site doesn't support some embeds.

    Can you embed a picture using a third-party service, or just to post a link to your image?

  • More info about the last error ("Es ist ein nicht behebbarer Fehler aufgetreten...") might be found in the php error log (or Apache error log respectively if the php error log isn't separate). This generic error message comes from Elgg but it won't tell you exactly what's wrong in this message in the browser but (usually) logs the details in the log file.

  • Thanks for you reply.

    It looks like we are using version 3.2.2.

    Other conditions are embarrassing: OS is still CentOS 7. We are about to upgrade the server and maybe switch from Apache to NGINX, but I am the only person doing server admin stuff, so I am not sure regarding this. I also think that Apache is not our main issue.

    I have seen the basic instructions for proxy_fcgi_module and CORS. I think that I am going to check the php errors and our Apache configuration, which is broken.

    Completely broken means, that I am getting a 500 and I think I need to search for it in our PHP logs.

  • I think that I have fixed the main issues in my Apache configuration, because I can use Elgg again (login etc.).

    But I still see a JavaScript error in my browser. It might be caused by some .htaccess or other server configuration, but I am not sure regarding it. Does this look familiar to anyone here?

    /community is our elgg-folder.

    Please note the top-level-domain change, I don't know yet what causes it.

    Uncaught Error: elgg/Ajax cannot be used with external URLs
    
    assertNotUrl https://our-domain.de/community/cache/1649259422/default/elgg/Ajax.js:28
    
    action https://our-domain.de/community/cache/1649259422/default/elgg/Ajax.js:26
    
    <anonymous> https://our-domain.de/community/cache/1649259422/default/input/form.js:1
    
    jQuery 8
    
    init https://our-domain.org/community/cache/1649259422/default/elgg.js:95
    
    trigger_hook https://our-domain.org/community/cache/1649259422/default/elgg.js:55
    
    each jQuery
    
    trigger_hook https://our-domain.org/community/cache/1649259422/default/elgg.js:55
    
    <anonymous> https://our-domain.de/community/cache/1649259422/default/elgg/init.js:2
    
    execCb https://our-domain.org/community/cache/1649259422/default/require.js:117
    
    check https://our-domain.org/community/cache/1649259422/default/require.js:59
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:76
    
    bind https://our-domain.org/community/cache/1649259422/default/require.js:12
    
    emit https://our-domain.org/community/cache/1649259422/default/require.js:78
    
    each https://our-domain.org/community/cache/1649259422/default/require.js:4
    
    emit https://our-domain.org/community/cache/1649259422/default/require.js:78
    
    check https://our-domain.org/community/cache/1649259422/default/require.js:64
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:77
    
    init https://our-domain.org/community/cache/1649259422/default/require.js:57
    
    callGetModule https://our-domain.org/community/cache/1649259422/default/require.js:78
    
    completeLoad https://our-domain.org/community/cache/1649259422/default/require.js:110
    
    onScriptLoad https://our-domain.org/community/cache/1649259422/default/require.js:117
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:125
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:117
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:58
    
    fetch https://our-domain.org/community/cache/1649259422/default/require.js:58
    
    check https://our-domain.org/community/cache/1649259422/default/require.js:59
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:77
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:108
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:77
    
    bind https://our-domain.org/community/cache/1649259422/default/require.js:12
    
    each https://our-domain.org/community/cache/1649259422/default/require.js:4
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:74
    
    init https://our-domain.org/community/cache/1649259422/default/require.js:57
    
    callGetModule https://our-domain.org/community/cache/1649259422/default/require.js:78
    
    completeLoad https://our-domain.org/community/cache/1649259422/default/require.js:110
    
    onScriptLoad https://our-domain.org/community/cache/1649259422/default/require.js:117
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:125
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:117
    
    load https://our-domain.org/community/cache/1649259422/default/require.js:58
    
    fetch https://our-domain.org/community/cache/1649259422/default/require.js:58
    
    check https://our-domain.org/community/cache/1649259422/default/require.js:59
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:77
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:108
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:77
    
    bind https://our-domain.org/community/cache/1649259422/default/require.js:12
    
    each https://our-domain.org/community/cache/1649259422/default/require.js:4
    
    enable https://our-domain.org/community/cache/1649259422/default/require.js:74
    
    init https://our-domain.org/community/cache/1649259422/default/require.js:57
    
    localRequire https://our-domain.org/community/cache/1649259422/default/require.js:104
    
    setTimeout handler*req.nextTick< https://our-domain.org/community/cache/1649259422/default/require.js:123
    
    localRequire https://our-domain.org/community/cache/1649259422/default/require.js:104
    
    requirejs https://our-domain.org/community/cache/1649259422/default/require.js:123
    
    <anonymous> https://our-domain.org/community/cache/1649259422/default/elgg.js:93
  • 1 - Check $CONFIG->wwwroot in your /elgg-config/settings.php

    2 - Check RewriteBase parameter in your .htaccess

    3 - 'Flush the caches' via Administration is recommended

  • The configurations look OK.

    Can I delete the cache manually (looks like a single file with timestamp as name) or would that break some functionalities?

  • Can I delete the cache manually (looks like a single file with timestamp as name) or would that break some functionalities?

    It's not a single file but directory located at /your-elgg-data-path/caches

    You can temporarily disable simple and system caching in Site Settings. Then run Upgrade.
    This should completely remove all the old cache.

    But I don't think the cache is the reason.

    Uncaught Error: elgg/Ajax cannot be used with external URLs

    It looks like the CORS errors.

    We use these headers in some project:

    Header add Access-Control-Allow-Origin "*" 
    Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type" 
    Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" 
    Header add Access-Control-Allow-Credentials "true"

    Please Google to learn more about CORS issues