Search code examples
phplaravelnginxforge

How to do advanced debugging of 404 Error on Forge Laravel Website


I recently migrated a previously working PHP Laravel website to DigitalOcean and am managing deployments with Forge. For DNS hosting, I am using AWS Route 53 (purchased domain there).

I believe there is something going on with the DNS, so I decided to make sure I could still see the website via the public IP. Unfortunately, I only seem to get a 404 error. Like I said, this site worked previously on AWS with the same Nginx, PHP, and Laravel versions.

404

All of the correct files are in the /public directory, Nginx does not show any compile or status errors, and its config file appears to be correct.

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/dev.agsflagfootballleague.com/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name dev.agsflagfootballleague.com;
    server_tokens off;
    root /home/forge/dev.agsflagfootballleague.com/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS_AES_256_GCM_SHA384:TLS-AES-256-GCM-SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS-CHACHA20-POLY1305-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/dev.agsflagfootballleague.com/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/dev.agsflagfootballleague.com-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/dev.agsflagfootballleague.com/after/*;

Any thoughts on what to debug/research next? I only want to be able to view my web app via IP address at the moment.


Solution

  • Can you try changing:

    listen 80;
    listen [::]:80;
    

    To:

    listen 80 default_server;
    listen [::]:80 default_server;