Hello :wave:
So, I can't get the greader.php api to stop returning a 502. I've tried following the config guidance from the documentation. (My current site config mirrors the recommended configuration example.) Similar searches through closed issues have had me modifying my Nginx config in multiple ways but nothing seems to have an effect.
Any ideas on where I could start debugging this issue?
Hello,
P.S.: you might be using nginx as a Web server and not as a proxy. In any case, please show your config and check your logs
Hi @Alkarex , I use LEMP stack too and I don't know since when, I got 502.
Which logs do you need? Snippets of some of my config:
nginx config (rss.ybbond.dev)
...
root /home/ybbond/www/freshrss/p/;
index index.php index.html index.htm;
access_log /var/log/nginx/rss.access.log;
error_log /var/log/nginx/rss.error.log;
# php files handling
# this regex is mandatory because of the API
location ~ ^.+?\.php(/.*)?$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
# By default, the variable PATH_INFO is not set under PHP-FPM
# But FreshRSS API greader.php need it. If you have a “Bad Request” error, double check this var!
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
try_files $uri $uri/ index.php;
}
...
/etc/nginx/fastcgi_params
...
fastcgi_param PATH_INFO $fastcgi_path_info;
...
/etc/php/7.3/fpm/pool.d/www.conf
...
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/php7.3-fpm.sock
...
I know nothing about server management, so if there is any docs or forum that may lead me to self-diagnose, I am willing to read. Thanks 😃
Please check your logs in /var/log/nginx/*.log and ./FreshRSS/data/users/_/log_api.txt
And check your API status via https://your-freshrss.example.net/api/
https://rss.ybbond.dev/api/ is 502 too, also the freshrss/data/users/_/log_api.txt only contains the error because I tried to login with wrong password 5 days ago.
/var/log/nginx/rss.error.log:
2020/05/16 15:10:54 [crit] 16056#16056: *12 connect() to unix:/var/run/php/php7.3-fpm.sock failed (13: Permission denied) while connecting to upstream, client: xx.xx.xxx.xx, server: rss.ybbond.dev, request: "GET /api/greader.php/reader/api/0/token HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "rss.ybbond.dev"
2020/05/16 15:10:58 [crit] 16056#16056: *12 connect() to unix:/var/run/php/php7.3-fpm.sock failed (13: Permission denied) while connecting to upstream, client: xx.xx.xxx.xx, server: rss.ybbond.dev, request: "POST /api/greader.php/reader/api/0/edit-tag HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "rss.ybbond.dev"
btw, thanks for the reply @Alkarex !
oh, there is this error in /var/log/nginx/error.log:
2020/05/16 07:11:09 [alert] 29510#29510: *829 open socket #3 left in connection 6
2020/05/16 07:11:09 [alert] 29510#29510: aborting
2020/05/16 14:35:17 [emerg] 15047#15047: invalid host in upstream "/run/php/php7.3-fpm.sock" in /etc/nginx/sites-enabled/rss.ybbond.dev:13
2020/05/16 14:35:30 [emerg] 15051#15051: invalid host in upstream "/var/run/php/php7.3-fpm.sock" in /etc/nginx/sites-enabled/rss.ybbond.dev:13
I don't know in what Timezone those time are. My php is set to Asia/Jakarta, but I think I have not set the timezone for nginx.
I tried changing the fastcgi_pass nginx config for my subdomain for rss, maybe afore listed error related to that
Does your other PHP applications work? What about the rest of FreshRSS?
It looks like an nginx misconfiguration. Have you maybe changed PHP version recently?
Try to put the following file in /home/ybbond/www/freshrss/p/phpinfo.php and access it:
<?php
phpinfo();
nginx is very error prone, but we have alternatives, for instance we offer a ready-to-use Docker image, a YunoHost package.
@Alkarex I found the culprit!
/etc/php/7.3/fpm/pool.d/www.conf has value:
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
while I remember setting the nginx user to be my name from a tutorial to setup LEMP stack back then.
That's why the rss.error.log says permission denied!
Thanks for the help!
and from what I know, Docker is a heavy process, so for now, I avoid the docker way of installing self-hosted apps. Maybe I'll try docker in other sandbox VPS, but for now, I prefer stay safe.
I also remember updating nginx and php this morning. there was a prompt to whether use package maintainer version vs use your edited version for some config. maybe that.
The main cost of Docker is a bit of disc space; CPU-wise it is almost cost-neutral, and memory-wise, it is almost not noticeable. But it is a lot easier and faster than a manual setup, starting FreshRSS with one single command line, with versioning, logs, cron, etc.
Thanks @Alkarex you are very helpful, and sorry thread starter @trst if we are going off-topic here.
I might try setting up a dockerized server later, knowing that docker should only costs more disc space. 🐳
For reference, a FreshRSS Docker deployment using the Alpine version (smallest) uses about 95MB on disk (including Apache and PHP)
For reference, a FreshRSS Docker deployment using the Alpine version (smallest) uses about 95MB on disk (including Apache and PHP)
Alpine is all things small lol.
The reason of my statement before is that the backend of my current workplace uses docker-compose for their prototype projects. Me, as a frontend, will fear when trying the MVP because the docker process will crank up my macbook's cpu process to the max (docker + my node localhost setup).
btw, I hope for you & your family's health in this pandemic situtation.
Thanks :-) The cause of the symptoms you describe are most likely due to the application itself and not due to its Docker deployment. Docker on Linux is also more efficient than on other platforms.
For reference, a FreshRSS Docker deployment using the Alpine version (smallest) uses about 95MB on disk (including Apache and PHP)
It would be awesome if change Apache to nginx
@debiansid Why?