ELGG & Nginx many problems...

Greetings! Elgg can work with Nginx? According to my tests, with Nginx has a lot of problems. Many problem...

https://example.org/upgrade.php:

You must update your .htaccess file so that the path is injected into the GET parameter __elgg_uri (you can use install/config/htaccess.dist as a guide).

Why??

My nginx config:

server {

  # -------------------------------------------------------------------------- #
  # Variables.
  # -------------------------------------------------------------------------- #

  set $srvUser   "web_example_org";
  set $srvDomain "example.org";

  # -------------------------------------------------------------------------- #
  # Server name & IP.
  # -------------------------------------------------------------------------- #

  listen      443 ssl http2;
  server_name example.org;

  # -------------------------------------------------------------------------- #
  # Logs.
  # -------------------------------------------------------------------------- #

  error_log   "/home/project/web_cbrspc04/.logs/nginx.error.example.org.log";
  access_log  "/home/project/web_cbrspc04/.logs/nginx.access.example.org.log" main;

  # -------------------------------------------------------------------------- #
  # Root & index.
  # -------------------------------------------------------------------------- #

  root  "/home/project/web_cbrspc04/domain/public_html";
  index index.html index.htm index.php;

  # -------------------------------------------------------------------------- #
  # SSL.
  # -------------------------------------------------------------------------- #

  ssl                 on;
  ssl_certificate     "/home/project/example.org/example.org.crt";
  ssl_certificate_key "/home/global/server.crt.key";

  # -------------------------------------------------------------------------- #
  # Location.
  # -------------------------------------------------------------------------- #

  location / {
    try_files $uri $uri/ @elgg;
  }

  location = /rewrite.php {
    rewrite ^(.*)$ /install.php;
  }

  location ~ \.php$ {
    try_files $uri @elgg;

    fastcgi_pass "unix:/run/php-fpm/$srvDomain.sock";
    fastcgi_index "index.php";
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    include "/etc/nginx/fastcgi_params";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

  location @elgg {
    fastcgi_pass "unix:/run/php-fpm/$srvDomain.sock";

    include "/etc/nginx/fastcgi_params";
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    fastcgi_param SCRIPT_NAME /index.php;
    fastcgi_param QUERY_STRING __elgg_uri=$uri&$args;
  }
}
  • Seems that your config is correct (docs).

    All our Elgg productions works on Nginx w/o any issues.

    Can you explain about server errors with more details?

     

  • Can you explain about server errors with more details?

     More no information. Logs empty.

    I have enabled open_basedir, but when I tested it unplugged. I changed a lot of configuration options. I even just copied nginx config from elgg setup directory. Anyway the exact same error.

    # Nginx -V
    nginx version: nginx / 1.11.1
    built by gcc 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
    built with OpenSSL 1.0.2h-fips 3 May 2016
    TLS SNI support enabled
    configure arguments: --prefix = / usr / share / nginx --sbin-path = / usr / sbin / nginx --conf-path = / etc / nginx / nginx.conf --error-log-path = / var / log / nginx / error.log --http-log-path = / var / log / nginx / access.log --http-client-body-temp-path = / var / lib / nginx / tmp / client_body --http -proxy-temp-path = / var / lib / nginx / tmp / proxy --http-fastcgi-temp-path = / var / lib / nginx / tmp / fastcgi --http-uwsgi-temp-path = / var / lib / nginx / tmp / uwsgi --http-scgi-temp-path = / var / lib / nginx / tmp / scgi --pid-path = / run / nginx.pid --lock-path = / run / lock / subsys / nginx --user = nginx --group = nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-google_perftools_module --with-debug --with -stream --with-cc-opt = '- O2 -g -pipe -Wall -Werror = format-security -Wp, -D_FORTIFY_SOURCE = 2 -fexceptions -fstack-protector-strong --param = ssp-buffer-size = 4 -grecord-gcc-switches -specs = / usr / lib / rpm / redhat / redhat-hardened-cc1 -m64 -mtune = generic '--with-ld-opt =' - Wl, -z, relro -specs = / usr / lib / rpm / redhat / redhat-hardened-ld -Wl, -E '
    
    # Php -v
    PHP 7.0.7 (cli) (built: May 25, 2016 17:47:24) (NTS)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
        with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
  • But what going on: you can't install Elgg, or other troubles?

  • But what going on: you can't install Elgg, or other troubles?

    When used scheme USER < NGINX [PROXY] < NGINX [PHP-FPM] I can not install elgg. I described the problem, you know. Now I have changed scheme on USER < NGINX [PHP-FPM]. In this scheme, the installation goes okay.

    But I want check all functions. I decided to click button "Upgrade" in AdminCP. And instead of update page, I get the error:

    You must update your .htaccess file so that the path is injected into the GET parameter __elgg_uri (you can use install/config/htaccess.dist as a guide).

  • You got this message.

    Try to go to Upgrades under Configure section. What you see in there?

  • Problem solved!
    The problem was this:

      # -------------------------------------------------------------------------- #
      # Auth.
      # -------------------------------------------------------------------------- #
    
      auth_basic "Maintenance";
      auth_basic_user_file "/maintenance.htpasswd";
    

    When enabled nginx auth_basic, there is a problem with upgrade.php. Strange ...

  • Yes exactly. Now again I included auth_basic and again there was a problem.
    @RvR thank you for your help and support!!! :)