Open gamerlv opened 6 years ago
Thanks for this detailed issue.
Can you also show me the php script (aka front controller if you're using a framework) which serves any url like /_spx ?
So far I've not needed any web server other than the built-in one from php for my projects. The web server does not serve any content at this point in time. I've been trying to profile a Laravel artisan task, trying to find bottlenecks.
My nginx config reflects that. Everything is passed through to php-fpm. The /srv
folder just contains a phpinfo() file to check if everything was being loaded.
server {
listen 80 default_server;
root /srv;
location / {
include "fastcgi.conf";
fastcgi_pass 127.0.0.1:9000;
}
}
To have SPX web ui working you need to have a php script called on any unexisting URL (like a framework front controllers) including those starting with /_spx. See try_files for nginx.
I tried to configure it with nginx and laravel I get the same error: here is the error:
| 172.19.0.1 - - [30/May/2018:16:49:08 +0000] "GET /_spx/?SPX_KEY=dev HTTP/1.1" 500 1470 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"
And my config
server {
listen 80;
listen [::]:80;
server_name spx.local;
root /srv/site/public;
index index.php index.html;
location @handler {
rewrite / /index.php;
}
location ~* _spx {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass ppm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
@aftabnaveed you do not need a dedicated vhost. Can you show me your application vhost config ? The only required thing is PHP being triggered on /_spx* request URIs, as long as _spx
is the configured prefix (which is the case by default).
@NoiseByNorthwest
This is my vhost which points to a Laravel Application:
server {
listen 80;
listen [::]:80;
server_name spx.local;
root /srv/site/public;
index index.php index.html;
location @handler {
rewrite / /index.php;
}
location ~* _spx {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass ppm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
And my spx.ini
extension=spx.so
spx.http_enabled=1
spx.http_key="dev"
spx.http_ip_whitelist="172.19.0.1,10.0.75.1"
I tried both IPs separately but still it won't work.
SPX from my php.ini
SPX Support | enabled
-- | --
SPX Version | 0.2.4
SPX Support | enabled
-- | --
SPX Version | 0.2.4
OK it finally worked for my by fixing the location for _spx in my vhost. Here is the version which worked
server {
listen 80;
listen [::]:80;
server_name spx.local;
root /srv/laraveltest/public;
index index.php index.html;
location @handler {
rewrite / /index.php;
}
location ~ /_spx {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass ppm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Now its time to play with it.
@aftabnaveed thanks for your feedback.
I'm trying to access the web ui to read out some CLI profiles created but I'm having trouble accessing it. I've followed the steps as laid out in the readme but after a few attempts, I'm not really getting anywhere.
When I try to access
http://localhost/_spx?SPX_KEY=dev
I get a bad gateway error. With both Nginx and Caddy.The PHP error logs reports the following:
When I try to access
http://localhost/_spx/?SPX_KEY=dev
orhttp://localhost/_spx/index.html?SPX_KEY=dev
through nginx I get weird malformed html presented as text. See spx_responses.txtVersions
I'm using the following software:
PHP 7.1.15-1+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:10:13) ( NTS )
PHP is used as php-fpm through tcp socket to Nginx.nginx version: nginx/1.13.9 Built by gcc 6.4.0 (Alpine 6.4.0) Built with OpenSSL 1.0.2n 7 Dec 2017 TLS SNI support enabled
Through docker:nginx:alpine
(537527661905)I just build the extension from source, commit 91ea8d6b75ac97603f0d9ad08568315482b60aef.