php-spx icon indicating copy to clipboard operation
php-spx copied to clipboard

Laravel+Nginx+Fpm no Web UI

Open yaroslavmo opened this issue 3 years ago • 6 comments

Hi. I am trying to get SPX working in Laravel.

The CLI is working fine but I could not get to the Web UI.

Here is Nginx config:

server {

  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;
  root /opt/dreamfactory/public;
  index index.php index.html index.htm;
  gzip on;
  gzip_disable "msie6";
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {

    root /usr/share/nginx/html;
  }
  location ~ \.php$ {

    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

When I open http://<my application host>/, it redirects me to the login page http://<my application host>/dreamfactory/dist/index.html#/login. When I try http://<my application host>/?SPX_KEY=dev&SPX_UI_URI=/ according to the doc it still just redirects me to the login page. At this point, I have never seen the Web UI of SPX on my site. Can you help me get it working?

yaroslavmo avatar Mar 04 '21 16:03 yaroslavmo

Have you tried this (info from docs) ?

But, on most PHP-FPM setups, you will have a permission issue preventing SPX to open a file under /proc/self directory. This is due to the fact that PHP-FPM master process runs as root when child processes run as another unprivileged user.

When this is the case, the process.dumpable = yes line must be added to the FPM pool configuration so that child processes will be able to read any file under /proc/self.

ilnytskyi avatar Mar 08 '21 10:03 ilnytskyi

Yes I tried to set dumpable it did not help

yaroslavmo avatar Mar 11 '21 08:03 yaroslavmo

The authentication fails so your script is executed instead of SPX's UI. You should have some logs explaining why the access is not granted.

The 2 main possible issues are:

  • IP address mismatch
  • secret key mismatch

What are your SPX INI settings ? Do you use docker ?

NoiseByNorthwest avatar Mar 15 '21 22:03 NoiseByNorthwest

Can be related to https://github.com/NoiseByNorthwest/php-spx/issues/114#issuecomment-600426937

kandy avatar Apr 13 '21 17:04 kandy

del

viktorprogger avatar Jul 14 '22 15:07 viktorprogger

You will fix your issue by spx.http_trusted_proxies="*"

talbergs avatar Apr 11 '23 04:04 talbergs