Coder Social home page Coder Social logo

Comments (8)

NoiseByNorthwest avatar NoiseByNorthwest commented on August 20, 2024

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 ?

from php-spx.

gamerlv avatar gamerlv commented on August 20, 2024

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;
	}
}

from php-spx.

NoiseByNorthwest avatar NoiseByNorthwest commented on August 20, 2024

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.

from php-spx.

aftabnaveed avatar aftabnaveed commented on August 20, 2024

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;
    }

}

from php-spx.

NoiseByNorthwest avatar NoiseByNorthwest commented on August 20, 2024

@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).

from php-spx.

aftabnaveed avatar aftabnaveed commented on August 20, 2024

@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



from php-spx.

aftabnaveed avatar aftabnaveed commented on August 20, 2024

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.

from php-spx.

NoiseByNorthwest avatar NoiseByNorthwest commented on August 20, 2024

@aftabnaveed thanks for your feedback.

from php-spx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.