Disclaimer: I've tried tips listed in probably every google result on the first 2 pages. None of them worked for me. This is not a duplicate.
I'm running Debian 9 in LXC container that had LAMP installed, today I wanted to replace apache2 with php-fpm and nginx. The problem is that I can't get this config to work at all.
The "default" virtual host is disabled (file/symlink not present in sites-enabled)
Current config (sites-enabled/phpmyadmin):
server {
listen 127.0.0.1:80;
root /home/fakeuser/fakepath;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location ~\.php$ {
include snippets/fastcgi-php.conf;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm-phpmyadmin.sock;
include fastcgi_params;
}
location /phpmyadmin {
alias /usr/share/phpmyadmin;
location ~\.php$ {
include snippets/fastcgi-php.conf;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/$fastcgi_script_name;
fastcgi_pass unix:/run/php/php7.0-fpm-phpmyadmin.sock;
include fastcgi_params;
}
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
When I try to open:
localhost/index.php
I get index.php downloaded to my pc
when I try to open:
localhost/phpmyadmin/index.php
I get "File not found." and this entry in
/var/log/nginx/error.log
2018/09/17 19:22:37 [error] 27804#27804: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /phpmyadmin/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm-phpmyadmin.sock:", host: "localhost"
UPDATE: I've checked log of php-fpm, and it just prints this into log every time:
- - 20/Sep/2018:21:03:26 +0000 "GET /phpmyadmin/index.php" 404
I have no idea what I'm doing wrong, www-data user have access to everything in that directory, I've checked 5 times by now.