Closed itz-Jana closed 4 years ago
Hi,
You just miss the rewrite logic ( given as .htaccess
). Something like this should work:
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
Cheers!
Hi! Thanks, I put that into the / location and it now rewrites successfully, but sadly my php doesn't execute for some reason and I just get the source code of the index.php file back. The socket is correct, I use it like that for other applications as well.
location / {
try_files $uri $uri/ /index.php;
}
There you go :)
Well, now the php at least seems to execute, but I get an internal server error :/
> LineageOTAUnitTest@0.0.1 test /home/jonatan/LineageOTAUnitTest
> node tests/lineage.js
<h1>500 Internal Server Error</h1><h3>Trying to access array offset on value of type null (8)</h3><pre>#0 /var/www/lineage-ota/src/Helpers/Build.php(106): flight\Engine->handleError()
#1 /var/www/lineage-ota/src/Helpers/Builds.php(155): JX\CmOta\Helpers\Build->isValid()
#2 /var/www/lineage-ota/src/Helpers/Builds.php(49): JX\CmOta\Helpers\Builds->getBuilds()
#3 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Loader.php(125): JX\CmOta\Helpers\Builds->__construct()
#4 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Loader.php(81): flight\core\Loader->newInstance()
#5 /var/www/lineage-ota/vendor/mikecao/flight/flight/Engine.php(101): flight\core\Loader->load()
#6 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(198): flight\Engine->__call()
#7 /var/www/lineage-ota/vendor/mikecao/flight/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod()
#8 /var/www/lineage-ota/src/CmOta.php(111): Flight::__callStatic()
#9 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(173): JX\CmOta\CmOta->JX\CmOta\{closure}()
#10 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(145): flight\core\Dispatcher::callFunction()
#11 /var/www/lineage-ota/vendor/mikecao/flight/flight/Engine.php(339): flight\core\Dispatcher::execute()
#12 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(198): flight\Engine->_start()
#13 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(144): flight\core\Dispatcher::invokeMethod()
#14 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(49): flight\core\Dispatcher::execute()
#15 /var/www/lineage-ota/vendor/mikecao/flight/flight/Engine.php(92): flight\core\Dispatcher->run()
#16 /var/www/lineage-ota/vendor/mikecao/flight/flight/core/Dispatcher.php(198): flight\Engine->__call()
#17 /var/www/lineage-ota/vendor/mikecao/flight/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod()
#18 /var/www/lineage-ota/src/CmOta.php(69): Flight::__callStatic()
#19 /var/www/lineage-ota/index.php(37): JX\CmOta\CmOta->run()
#20 {main}</pre>
Here a fresh copy of the changed part of the nginx config.
proxy_set_header Forwarded "host=$host;proto=https";
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
You can remove the
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
part, as the location section will do just fine :)
Another thing, the error is complaning about trying to access something in the ZIP file. Is that a valid build? You can try that out by using one of the latest LOS ZIPs and placing that inside of builds/full
directory.
Okay, I removed the "if" and there was no change, then I tried changing the php-fpm version to 7.3, which I also still had installed. Upon switching to 7.3, it started working. Is this software not compatible with php-fpm 7.4?
And yay, now it's working and my Android device updated successfully :)!
I need to test it on top of PHP 7.4, but if you can submit a PR I'll be more than happy to merge it. Thank you!
Sadly I have 0 php experience and I just tried to look into it but failed at the most basic level (Outputting some debug info). I'll just keep using 7.3 for now :)
Allright :) thank you then, I'll close this ticket. Enjoy!
Hello all,
I really want to get this working on my server for my lineage builds but I am unable to get it to work with my Nginx Reverse Proxy. I am pretty sure it has to do with my Nginx config and it somehow not processing the requests with the .php script (I have pretty much no experience with php).
I have copied the config together from my other ones + some things I found around here (the part with the comment) but now I am unable to find it again.
If I go to / it redirects me to /builds/ and displays the folder structure just fine, if I access anything at /api, it returns a 404 Not Found from nginx. I tried with the LineageOS Updater as well as manually using the UnitTest and/or curl.
Any hints towards what I am doing wrong would be highly appreciated!