Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Presto's avatar

Nginx 404 after first deploy

Hello everyone,

I just setup my first server and site on Forge it was pretty much straightforward, I was able to get my server setup on AWS then in Forge, I deployed my first repo from BitBucket without any issues, but when I go to the domain I get the following message "404 Not Found - nginx/1.8.0", I'm guessing that Forge or more likely I may not have set up something correctly in the Nginx config file? I have not touched the Nginx config file thinking that Forge would of taken care of all of that for me, but maybe I am not correct? Please let me know where to check to see if maybe I have over looked something. Thanks guys.

0 likes
3 replies
Presto's avatar
Presto
OP
Best Answer
Level 6

Ended up wiping out the site's repo and reinstalling it, and that fixed it for some reason.

dtoffling's avatar

Same thing was happening to me on new site creation. I compared the Nginx config file before and after and it looks like it was losing the 'default_server'


//Before:
server {
   listen 80 default_server;
   listen [::]:80 default_server;
   server_name default;
   root /home/forge/default/public;

//After New Site Creation:
server {
   listen 80;
   listen [::]:80;
   server_name mysite.com;
   root /home/forge/mysite.com/public;

I added the 'default server' back in the Nginx config file and it worked like a champ:

//Updated Config:
server {
   listen 80 default_server;
   listen [::]:80 default_server;
   server_name mysite.com;
   root /home/forge/mysite.com/public;
bashy's avatar

@dtoffling You don't actually "need" a default server block. nginx will use the the last it finds?

Please or to participate in this conversation.