1

Background

I'm trying to get an nginx /php-fpm7 site up and running on an alpine linux server.

Problem

No errors appear when i navigate to it. Cert is good. And the in the /var/log/access.log file I see a GET request hitting the site. But ... the website/app that i've defined in /etc/nginx/conf.d/default.conf is NOT being loaded / triggered. I should be prompted with a login page. Here are the various artifacts:

What I've checked

nginx is running and listening. php-fpm is also running and listening

mywww:/etc/nginx/conf.d# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      3979/php-fpm.conf)
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4480/nginx.conf

nginx.conf loads all confs in /etc/nginx/conf.d/default.conf

 mywww:/etc/nginx# cat nginx.conf | grep conf.d
    include /etc/nginx/conf.d/*.conf;

default.conf looks like this:

server {
        listen 443 ssl;
        root /var/www/mywebapplication.com/public;
        server_name mywebbapplication.com;

        ssl_certificate /etc/ssl/a/bundle.crt;
        ssl_certificate_key     /etc/ssl/a/thekey.key;
        ssl_protocols   TLSv1 TLSv1.1 TLSv1.2;

        error_log /var/log/nginx/mywebapplication.log notice;
        index login.php;
        allow all;

        location / {
                try_files $uri $uri/ /=404;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index login.php;
                include fastcgi_params;
        }
}

The login page exists:

  mywww:/etc/nginx# ls -lah /var/www/mywebapplication.com/public/login.php
 -rw-r--r--    1 root     root          66 Apr 25  2019 /var/www/mywebapplication.com/public/login.php

Nginx Access Log files:

198.1.2.1 - - [24/Mar/2020:15:06:25 +0000] "GET / HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebK│it/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Mobile Safari/537.36" "-"                                                                 │
198.1.2.1 - - [24/Mar/2020:15:06:29 +0000] "GET /login.php HTTP/1.1" 200 5 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Mobile Safari/537.36" "-"                                                        │

User / Group under which process is running:

mywww:/var/www/mywebapplication.com/public# ps aux | grep php
 3979 root      0:00 {php-fpm7} php-fpm: master process (/etc/php7/php-fpm.conf)
 3986 nginx     0:00 {php-fpm7} php-fpm: pool www
 3987 nginx     0:00 {php-fpm7} php-fpm: pool www
 4716 root      0:00 vim /etc/init.d/php-fpm7
 4719 root      0:00 grep php

The user for nginx is "nginx":

mywww:/etc/nginx# cat /etc/nginx/nginx.conf | grep user   
user nginx nginx;

is it ok that the nginx master process is running as root?

Not sure what else I should check for.

1 Answer 1

2
    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index login.php;
            include fastcgi_params;
    }

changed to

    location ~ \.php$ {
           # fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
           # fastcgi_index login.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.