Closed jayhlee closed 2 years ago
I think I figured out what the issue is. During the process of nitro create myproject
, if you set the web root for the site to be public
rather than the default web
, a 404 error is thrown.
@jayhlee it should generate the directory for you but it might take a while to sync the files if you have a lot of assets in the site. Can you run nitro ssh
and cat /etc/nginx/conf.d/default.conf
and provide the output of the site that is 404'ing?
The issue seems to be that when you create a new project using nitro create <myproject>
and you choose the web root to be something other than web
, a 404 error is thrown because the web root directory that's created is still web
. The fix is easy, which is to just change web
to the name of the web root you specified during the nitro create
process.
Not sure if others may have gotten stuck on this. But it'd be nice if the name of the web root that's specified during the nitro create
process would generate the web root file to reflect that name (rather than create a web
web root directory indiscriminately).
@jayhlee what is the web root defined in your nitro.yaml
site config?
The web root defined in nitro.yaml
is set to what it was defined as when nitro create
was run. So if it was set to public
, it'll be defined as public
. The hiccup, however, is that if you define the web root as public
(or something else other than web
) during the nitro create
process, the files and folders that are built will create a folder named web
—regardless of what you actually defined it to be during the nitro create
process. And this is what causes the issue.
As I mentioned, the fix is simple. Namely, to just rename the generated web
folder to public
(or whatever it was named during the nitro create
process). But it'd be nice to have the generated web root folder be named to what it was defined as during the nitro create
process. I assumed this would be the case, which was where I went astray.
Just adding to this that I've hit the same issue. During setup I defined the web root as "public" and it created a folder called "web" instead, but the nitro.yaml file correctly had referenced it as "public". Yes it's an easy fix to just rename the folder, but evidently the nitro create script is asking the question and not using that answer when creating the folder.
Hi, we are closing this issue as we have decided to retire Nitro, so no additional work will occur on this project. You can read the official blog post here https://craftcms.com/blog/retiring-craft-nitro. We appreciate everyones feedback and involvement and we look forward to refocusing our efforts on Cloud!
If you're looking for a new local development environment, we recommend DDEV and have a knowledge base article to help you with the transition: https://craftcms.com/knowledge-base/migrating-from-craft-nitro-to-ddev.
Description
I can successfully create a new project and set up Craft. However, when I go to my newly created site (mysite.nitro), I get a 404 error.
Steps to reproduce
nitro create myproject
nitro craft setup
Additional info