Open bbrala opened 6 years ago
Hi,
The web UI does not include a dedicated HTTP server, it is simply served by the same server which served your PHP application.
Have you tried opening http://localhost/_spx?SPX_KEY=dev
with the proper configuration as described here ?
Hmm, yeah i tried, i can only run it from my host machine (its an vm), and apache is just serving the vhost bound. When i run it with lynx from the console i get an 404.
You should check your client ip var_dump($_SERVER['REMOTE_ADDR']);
and put the right value in the configuration spx.http_ip_whitelist="<Your IPv4 address>"
I'll doublecheck that, since i did put my ip in the whitelist, but perhaps i made a typo. Ill get back to you.
You may be interested by last revision of master which include some useful logs (in nginx error log or fpm error log) in case web ui access failure. See #23
@bbrala as explained in this related issue #22 the UI root url without a trailing slash does not work. I've updated the README. You must use http://localhost/_spx/?SPX_KEY=dev
instead.
Ah cool, tomorrow i have some time to check it out again. :)
Well, still not doing what it should really. I've build the current master.
Config file /etc/php/7.0/mods-available/spx.ini
[spx]
extension=spx.so
spx.http_enabled=1
spx.http_key=dev
spx.http_ip_whitelist=172.16.0.79,localhost
php -i | grep spx
spx.data_dir => /tmp/spx => /tmp/spx
spx.http_enabled => 1 => 1
spx.http_ip_var => REMOTE_ADDR => REMOTE_ADDR
spx.http_ip_whitelist => 172.16.0.79,localhost => 172.16.0.79,localhost
spx.http_key => dev => dev
spx.http_ui_assets_dir => /usr/share/misc/php-spx/assets/web-ui => /usr/share/misc/php-spx/assets/web-ui
spx.http_ui_uri_prefix => /_spx => /_spx
Apache log when trying to connect:
172.16.0.79 - - [15/Mar/2018:11:35:43 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.1" 404 497 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
172.16.0.79 - - [15/Mar/2018:11:35:43 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.1" 404 497 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
127.0.0.1 - - [15/Mar/2018:11:36:03 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 404 458 "-" "Lynx/2.8.9dev.8 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/3.4.9"
127.0.0.1 - - [15/Mar/2018:11:36:52 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 404 458 "-" "Lynx/2.8.9dev.8 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/3.4.9"
And th elocation of spx.ini. (apache has been restarted also)
$ locate spx.ini
/etc/php/7.0/apache2/conf.d/20-spx.ini
/etc/php/7.0/cli/conf.d/20-spx.ini
Hmm, could it be Apache is just not supported? :x
Yes it is possible. I'll try with apache2 this evening.
@bbrala I've an issue with apache2 / mod_php 7.0, web UI HTTP responses are ill-formed (see below). I'll fix it in a few days.
HTTP/1.1 200 OK
Date: Thu, 15 Mar 2018 21:51:52 GMT
Server: Apache/2.4.7 (Ubuntu)
Transfer-Encoding: chunked
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 12245
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SPX Control Panel</title>
<script>
(() => {
...
Thanks :)
I've got same result on apache2 / mod_php-5.6
@bbrala @cmizzi You should try last master revision. It should be ok since merge of #34.
I tried again in master, unfortunately, it is still nog working. Commandline is fine, but through apache still gives an 404.
Hum, it's look like to work for my configuration (apache2 / mod_php5.6
through nginx
)
RUN set -xe \
&& cd /tmp \
&& git clone https://github.com/NoiseByNorthwest/php-spx.git \
&& cd php-spx \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& echo "spx.http_enabled=1\nspx.http_key=\"dev\"\nspx.http_ip_whitelist=\"127.0.0.1,172.123.0.200\"\nspx.http_ui_assets_dir=/usr/share/misc/php-spx/assets/web-ui\nextension=spx.so" > /etc/php5/mods-available/spx.ini \
&& php5enmod spx
But, for projects working on Laravel, I've got a 301 loop redirections
HTTP/1.1 301 Moved Permanently
Server: nginx/1.12.2
Date: Mon, 19 Mar 2018 09:41:03 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Location: /_spx/?SPX_KEY=dev
Vary: Accept-Encoding
HTTP/1.1 301 Moved Permanently
Server: nginx/1.12.2
Date: Mon, 19 Mar 2018 09:42:07 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: http://xxx/_spx?SPX_KEY=dev
Vary: Accept-Encoding
The first tries to append the ending /
and the second removes it
Logs from mod_php
[19-Mar-2018 10:44:09 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:09 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:09 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:09 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
[19-Mar-2018 10:44:10 Europe/Paris] PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
Logs from Apache2
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx?SPX_KEY=dev HTTP/1.0" 301 305 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
172.123.0.200 - - [19/Mar/2018:10:44:55 +0100] "GET /_spx/?SPX_KEY=dev HTTP/1.0" 301 545 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36"
Edit: it seems the .htaccess
is executed (and trailing slash is applied).
@cmizzi OK I just see the .htaccess used by Laravel https://github.com/laravel/laravel/blob/master/public/.htaccess#L12
Is localhost/_spx/index.html?SPX_KEY=dev
OK for you ? If so I will make /_spx redirecting to /_spx/index.html
@bbrala Can you provide SPX notice logs ? (those starting with "SPX: access")
Can you also try (and give me the output with headers) the following urls ?
localhost/_spx?SPX_KEY=dev
localhost/_spx/?SPX_KEY=dev
localhost/_spx/index.html?SPX_KEY=dev
@NoiseByNorthwest This seems to work. I would be great to redirect on it, I don't think I'm not the only one with this issue. I didn't try directly in apache
configuration but it should work IMO
@cmizzi done on master (redirection to .../index.html)
What do you mean with the SPX notice logs?
This kind of log PHP Notice: SPX: access granted: "172.123.0.200" IP with "dev" key in Unknown on line 0
Please see @cmizzi comment above for a full example. BTW you need to set log_errors=1
in apache2's php.ini
I do not reproduce the apache2 bugs since merge of #34. So you have to help me by trying the urls listed in my previous comment and giving me back the response headers & spx notice logs.
Can you aslo give me your apache2 vhost setup & .htaccess ?
In my case it also doesn't work. I use:
spx.http_enabled=1
spx.http_key=dev
spx.http_ip_whitelist="*"
spx.http_trusted_proxies="*"
Everything is correctly installed. I use PHP fpm and Nginx. But the point is that I have a default fallback server configuration in Nginx, to catch all domains that aren't matching any of my server name configurations.
Hence the reason I think I just get my fallback URL, this localhost will never work in my Nginx setup:
curl http://localhost/?SPX_KEY=dev&SPX_UI_URI=/
[1] 3746249
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Such a server config may look like this:
server {
listen 80 reuseport default_server;
# Enable http/3
listen 443 quic reuseport default_server;
listen 443 ssl reuseport default_server;
server_name _;
# Use the default nginx folder
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
Hi,
I was trying to get this working on my dev env, but i can't reach the webinterface. Is there a possibility to run it on a different point so it doesn't conflict with apache?
Regards,
Bjorn.