Subpages and Images show 404 on my Digitalocean + Statamic Dev Environment

145 views Asked by At

I am currently setting up a dev environment for a small relaunch of a website. For that matter, I set up a new socket with needed php version, apache, nginx, mysql and pulled the current git version of the web. But all I can see is the content of the main page, even the links to some subpage dont work. The web uses "Statamic" as backend. Did I forget something basic? Thanks in advance for your help.

There are no ngnix error logs, I also tought of having to reinstall statamic somehow, but its not mentioned in the package.json of the original website.

Edit:

Here is my nginx config file for the domain:

server {
listen 80;
listen [::]:80;

root /var/www/xxx/public;
index index.php index.html index.htm index.nginx-debian.html;

server_name xxx.tanja-kobler.com;

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

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
 }

location ~ /\.ht {
    deny all;
}
}

UPDATE & SOLUTION:

I deleted apache2. But the main problem was this line in the ngnix configuration:

try_files $uri $uri/ =404;

I changed it to:

try_files /static${uri}_${args}.html $uri $uri/ /index.php?$query_string;

not it is working perfectly fine.

1

There are 1 answers

1
Camilo Martinez On

Be sure the APP_URL matches your URL name. These are also the commands I ran at deployment time.

php artisan optimize:clear

php please static:clear

php please glide:clear

php please assets:generate-presets

php please assets:meta

php please stache:refresh

If you are using OPCache

sudo -S service php8-fpm reload

php please static:warm