404 on all pages (installation)

Hello,

I am trying to install invoiceplane on Ubuntu 16.04 w/ Nginx. I have read and tried all the other posts but can’t get it to work.

Originally this is what my nginx looked like,

server {
    listen      80;
    server_name my.site.pw;
    rewrite     ^   https://$server_name$request_uri? permanent;
}

server {
    server_name my.site.pw;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;

    listen 443 ssl;
    root /var/www/my.site.pw;
    index index.php index.htm index.html;

    location = /favicon.ico {
            alias    /var/www/site.pw/favicon.ico;
            try_files $uri $uri/ /index.php?$query_string;
        }

    error_page 404 /404.html;
    location = /404.html {
                root /var/www/error_page;
                internal;
        }

    error_page 403 /403.html;
    location = /403.html {
                root /var/www/error_page;
                internal;
        }
}

However that didn’t work so I added this

server {
    listen      80;
    server_name my.ncs.pw;
    rewrite     ^   https://$server_name$request_uri? permanent;
}

     location / {
            try_files $uri $uri/ /index.php;
        }
     location ~ .php$ {
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php5-fpm/socket_name.socket;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

Before it 404’d with that addition it gave 502.
Just to see it all together this is what it fully looks like, https://hastebin.com/bagebekiju.php

Thanks