I am hosting an application for my own consumption only - Lychee - so after a lot of struggle I am stuck with one last portion -
2022/09/19 22:06:18 [error] 11361#11361: *40 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: Failed to open stream: Permission denied in Unknown on line 0Unable to open primary script: /var/www/wallabag/web/app.php (Permission denied)" while reading respons
e header from upstream, client: 127.0.0.1, server: pop.wallabag.cerulean, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "pop.wallabag.cerulean"
my best guess is file level access issue -I am not sure which user should be given for this to work
I have given fpm sock access to nginx
tired giving folder access to nginx but its not working - any input suggestion
Apparently you have seen a www-data somewhere, but you failed to tell where.
I think you can imagine that when it has an equivalent on openSUSE, the openSUSE users here may know that. But they probably do not know that the equivalent of what they know is www-data on a system they also not know. Or do you expect clairvoyance?
My sincere apologies. I have earlier used Ubuntu - in Ubuntu bases system there is a user www-data who is the user that web servers on Ubuntu (Apache, nignx) use by default for normal operation - so when a web site is self hosted the www-data is made the owner of the folders and directories through chown command.
I am not getting the equivalent of the same in Opensuse - I am using nginx and the files are located in www/var/lychee
I am stuck with the folder level permissions - whom to give.
I have no idea what Lychee is. It is not a package in the main repository, and searching for a package that provides also returns nothing.
Please understand that the knowledge you have about your project is not the same knowledge other openSUSE users have. So do not assume they will understand you when you just throw in a few words that mean much to you but that not automagicaly mean anything to others.
The starting point for any questions here is openSUSE, not Ubuntu, about which many may have heard of, but that is it.
Hi, My bad not giving a clear description. Lychee is a self hosted website for organizing photos. I ideally host this web server on my system for personal use with no exposure to the internet.
I am using php 8, mysql and nginx. I have my Lychee folder containing the php and other files under /srv/www/Lychee.
When I try to access the site I get “Access Denied”. When I am going and checking in the /var/log/nginx/lychee.error.log I get the following error -
2022/09/20 18:43:58 [error] 2053#2053: *13 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: Failed to open stream: Permission denied in Unknown on line 0Unable to open primary script: /srv/www/Lychee/public/index.php (Permission denied)" while reading respon
se header from upstream, client: 127.0.0.1, server: pop.lychee.cerulean, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "pop.lychee.cerulean"
if I go to nginx conf file in /etc/nginx/nginx.conf then it contains the following -
user wwwrun;
worker_processes 1;
if I go to /etc/php8/fpm/fpm/php-fpm.d/
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = wwwrun
group = www
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
I have changed the ownership of the folders using the comman sudo chown -R wwwrun:www /srv/www/Lychee and also used chmod -R 755 (also 777) /srv/www/Lychee
after all this I am still getting the same error - access denied - I know I am missing something very simple here - but not able to zero down on the same. Can you help ?
It is much clearer now. But it is still unclear to me where you got that Lychee. As I said, I can not find it in the openSUSE standard repo (but I might be wrong). Always, when software is not from the standard repos, explain where you get it from and how you installed.
In any case, the message says a permission denied with /srv/www/Lychee/public/index.php. So the first thing to study is
ls -l /srv/www/Lychee/public/index.php
And also
ls -ld /srv/www/Lychee/public/
ls -ld/srv/www/Lychee/
ls -ld /srv/www/
ls -ld /srv
Because you say you have changed permissions, but not exactly what, thus one should check the complete path.
Hi, Thanks for your inputs - I think am inching to closure - here is the update -
localhost:~ # ls -l /srv/www/Lychee/public/index.php-rwxr-xr-x 1 wwwrun www 2614 May 21 01:54 /srv/www/Lychee/public/index.php
localhost:~ # ls -ld /srv/www/Lychee/public/
drwxr-xr-x 11 wwwrun www 4096 May 21 01:54 /srv/www/Lychee/public/
localhost:~ # ls -ld /srv/www/Lychee/
drwxr-xr-x 16 wwwrun www 4096 May 21 01:58 /srv/www/Lychee/
localhost:~ # ls -ld /srv/www/
drwxr-xr-x 12 wwwrun www 4096 Sep 18 15:52 /srv/www/
localhost:~ # ls -ld /srv
dr-xr-xr-x 1 wwwrun www 22 Sep 17 14:26 /srv
I also disabled apparmor and then rebooted my laptop - when i restarted nginx.service and php-fpm and trying to access the website I am getting 502 error code. When I am looking into /var/log/nginx/lychee.error.log I can see the following error code -
2022/09/21 00:37:07 [crit] 13779#13779: *1 connect() to unix:/run/php-fpm/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: pop.lychee.cerulean, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.
sock:", host: "pop.lychee.cerulean"
what should be my approach now ? it seems the earlier issues were because of apparmor because other then disabling it i havent made any changes in the owner ships.
Hi, I disabled it from YAST -> Services Manager -> apparmor
Now when I log into YAST Services Manager I can see that the status is Start (On Boot) State (Active Exited) but I guess I did something wrong here -
**[/FONT]To create a local version run “systemctl edit --full nginx” in a root shell, delete the automatic additions and save your edit. Restart nginx.
If apparmor is not the issue can I activate it again?
I tried doing the same. but I dont know why but my issue is still not resolved am still stuck with the 502 error code.
2022/09/22 21:22:11 [error] 9000#9000: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: Failed to open stream: Permission denied in Unknown on line 0Unable to open primary script: /srv/www/Lychee/public/index.php (Permission denied)" while reading respons
e header from upstream, client: 127.0.0.1, server: pop.lychee.cerulean, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "pop.lychee.cerulean"
For some strange reason this is an issue with php files only. I created one html file and it works fine.
What else can I share for a more accurate analysis?