Getting PHP 5.3 to work with NGINX

For specific reasons I installed PHP 5.3.5 on an Ubuntu Server 18.04 LTS.
At the moment I can't get the php to work when I call it.

I used the following topic to install PHP 5.3

When calling index.php I get a 404 back.
Files like html, jpg, txt works fine.

This is my "/etc/nginx/sites-available/default"

 server {
        listen   2053;
        server_name  localhost;
        access_log  /var/log/nginx/localhost.access.log;
    
    ## Default location
        location / {
            root   /var/www;
            index  index.php;
        }
    
    ## Images and static content is treated different
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
          access_log        off;
          expires           30d;
          root /var/www;
        }
    
    ## Parse all .php file in the /var/www directory
        location ~ .php$ {
                    try_files $uri =403;
                    # Alternatively you can set
                    # cgi.fix_pathinfo = false
                    # in php.ini
                    include /etc/nginx/fastcgi_params;
                    keepalive_timeout 0;
                    fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                    fastcgi_pass    127.0.0.1:9001;
        }
    
    ## Disable viewing .htaccess & .htpassword
        location ~ /\.ht {
            deny  all;
        }
    }
    upstream backend {
            server 127.0.0.1:9000;
    }

php -v

PHP 5.3.29 (cli) (built: Aug 26 2021 08:30:28)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

whereis php

php: /usr/local/bin/php /usr/local/lib/php

Is there a way to get this working?

Thank you in advance.

I recommend you get NGINX working first and then work on PHP with NGINX.

See, for example:

1 Like