Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Unable to use site URL to connect to Craft nitro #450

Closed
wallythewebdev opened this issue Feb 8, 2022 · 19 comments
Closed

Unable to use site URL to connect to Craft nitro #450

wallythewebdev opened this issue Feb 8, 2022 · 19 comments
Labels
bug Something isn't working

Comments

@wallythewebdev
Copy link

wallythewebdev commented Feb 8, 2022

Description

I cannot seem to use the SITE URL that I selected during the craft set up to access the craft website.
OR (maybe the issue is) - Nitro has not configured the host files to recognize the IP address of the site as the SITE URL

TLDR:

Q) is there a way to find out what IP address the nitro site is running on - like nitro open <sitename> ?

After posting the question I managed to find the answer to the Site IP address question:

By running: nitro bridge it will output the the IP address of the websites running on your machine
From docs: https://craftcms.com/docs/nitro/2.x/local-sharing.html

Q) is there a location to find out the sites details - or any errors to be addressed in its setup?
Q) can you download an earlier version of craft, or does the version of craft downloaded by Nitro match the version of PHP you set the project up with - so if you decide to run php 7.2 - Nitro downloads the version of Craft suited for PHP 7.2?

Steps to reproduce

  1. Run nitro create <sitename>
  2. Input required details - and have conformation of successful install
  3. run nitro craft setup & complete
  4. Try to acsess the site address: https://tutorial.nitro/ or http://tutorial.nitro/
  5. presented with This site can’t be reached

image

--

Any debugging steps would be really helpful (im very keen to use Nitro for local dev, but the set up has been bumpy) - thanks

@wallythewebdev wallythewebdev added the bug Something isn't working label Feb 8, 2022
@wallythewebdev wallythewebdev changed the title Unable to connect to Nitro website Unable to use site URL to connect to Craft nitro Feb 8, 2022
@TomDeSmet
Copy link

I have the same issue on Mac. Just installed Nitro (running on alternative port 8080 for http).
I can connect to the database, all containers are running but I cannot get to the site.

I have Valet installed too, maybe that has something to do with it?

@wallythewebdev
Copy link
Author

@TomDeSmet -

I found (from my above)

By running: nitro bridge it will output the the IP address of the websites running on your machine
From docs: https://craftcms.com/docs/nitro/2.x/local-sharing.html

If you see your craft website here and IP address - then you can use the IP address instead of the site name to access it.

@TomDeSmet
Copy link

TomDeSmet commented Feb 8, 2022

I already tried that but it doesn't work for me because I get the following error when trying to go to the IP url.
I obscured some data here of course.

connecting to the-craft.nitro
Bridge server listening on http://XXX.XXX.X.XXX:8000
2022/02/08 17:55:42  /
2022/02/08 17:55:42 http: proxy error: dial tcp 127.0.0.1:80: connect: connection refused

@wallythewebdev
Copy link
Author

@TomDeSmet This is kinda out of my depth - it has not been a easy set up on my end (using windows)....

But, check everything is running as required I guess??

Is the DB running? Check Docker

image

Command: nitro ls will list out the status as well:

image

If they have stopped you can start the process by using nitro start

image

@TomDeSmet
Copy link

Everything’s running fine. Not getting any errors of any meaning in the containers. I already stopped valet and restarted all containers. Nothing…

@wallythewebdev
Copy link
Author

@TomDeSmet what output do you get when you run the command craft bridge?

Should be:

image

What error do you get once you try and go to that IP address that is listed - if it is listed?

@TomDeSmet
Copy link

@wallythewebdev as stated in a previous post above:

connecting to mywebsite.nitro
Bridge server listening on http://XXX.XXX.X.XXX:8000
2022/02/08 17:55:42  /
2022/02/08 17:55:42 http: proxy error: dial tcp 127.0.0.1:80: connect: connection refused

@jasonmccallister
Copy link
Member

@TomDeSmet

I have Valet installed too, maybe that has something to do with it?

Valet and Nitro will conflict, if you try mysite.nitro:8080 it should resolve?

@wallythewebdev

By running: nitro bridge it will output the the IP address of the websites running on your machine
From docs: https://craftcms.com/docs/nitro/2.x/local-sharing.html

The bridge command looks at your local machine IP (your laptop) and allows you to share a site on the network with another device (e.g. iPad or iPhone). Nitro runs everything in localhost/127.0.0.1 so its not public to people on your network without the bridge command.

@wallythewebdev
Copy link
Author

wallythewebdev commented Feb 8, 2022

Hi @jasonmccallister - Thanks for the reply.

Thanks for mentioning the localhost/127.0.0.1 address - however this does not connect to the site.
Also, the IP address nitro bridge provides is now showing an error:

connecting to tutorial.nitro
Bridge server listening on http://XXXXXXXX:8000
2022/02/08 19:03:47  /
2022/02/08 19:03:47 http: proxy error: dial tcp: lookup tutorial.nitro on XXXXXXXXXX: no such host

Do you have any suggestions for how to debug the above (it worked yesterday after a fresh install).

Thanks

@TomDeSmet
Copy link

I already tried that and strange enough, now it works with the added port.
Is there a way to split valet and nitro or should I uninstall valet?

@TomDeSmet
Copy link

@wallythewebdev Check your host file, it should contain:

#<nitro>
127.0.0.1 tutorial.nitro
#</nitro>

@wallythewebdev
Copy link
Author

@TomDeSmet

Host file does not contain that: I manually added it and can access it from http://tutorial.nitro/ (which is great so thanks).

But this does make me wonder @jasonmccallister @TomDeSmet - is there a command missing to allow Nitro to update the host files & does this mean that Nitro needs to edit host files when it is started nitro start - Which if it is, is fine, I just need to make sure that it can if that is the case.

any suggestions?

@TomDeSmet
Copy link

My host file was edited when I added my project. So it's definitely possible. It prompts for your password when adding/creating a site to modify your host file.
And there's also the nitro hosts command.

@jasonmccallister
Copy link
Member

#@wallythewebdev There is a technical limitation on Windows that does not allow us to edit the hosts file. This page has more details on how to use Nitro with Windows https://craftcms.com/docs/nitro/2.x/windows.html

Glad you got it sorted!

@wallythewebdev
Copy link
Author

@TomDeSmet - Thanks for the suggestion - running nitro apply got it working by printing out the required host file path that needed to be added:

image

@jasonmccallister Ah that all makes way more sense now - thanks for the advice and pointing to the Docs.

Can I make a small UI suggestion for windows users regarding the docs, I know writing docs is not an easy task, and there is allot of information packed into them, but given the slightly different install process for windows and caveats (regarding limitations) - it might be best to separate out the docs into separate pages for Windows and Mac/Linux installs of Nitro.

One of the issues I came across was trying to piece together info from different doc pages instead of it being in one controlled flow of information that follows the install process.

Just some UX feedback, not a criticism, and I'm really grateful for the help you've given here.

@jasonmccallister
Copy link
Member

Thank you and that is probably a good suggestion @wallythewebdev, I'm going to ping @mattstein and see if this is something he wants to add/improve on the documentation.

If we have this working, I think we are ok to close this issue out?

@wallythewebdev
Copy link
Author

@jasonmccallister Yeah great and thanks for your help and @TomDeSmet as well -

if you want input on writing the docs - happy to help :)

@mattstein
Copy link
Contributor

Thanks @wallythewebdev!

If I’m understanding right, you’re saying it’d be easier to navigate Nitro + Windows docs if they were visually separated by that OS. I get that—there were enough Windows caveats that we separated out the install instructions by OS, and added that Development with Nitro and WSL2 page so we could (hopefully) call those things out clearly.

The ultimate goal, and the reason I’m hesitant to segregate the docs by OS, is to rejoin the docs flow for daily usage that shouldn’t vary significantly from one OS to another.

If there are more nuanced issues you had finding bits of information that were there I’d like to understand and address them, but I’m not sure about splitting the docs out by operating system. Let me know if I’m missing your point or if the unified-docs goal seems out of touch with reality! :)

@wallythewebdev
Copy link
Author

Hi @mattstein Thanks for the reply.

I'll spend a little time over the next coming days review the doc flow for installation and see if there are any instances I can pin point specifically.

I can see why you'd be hesitant to separate the docs into different pages for different installs, but I think some of the information stored on https://craftcms.com/docs/nitro/2.x/windows.html could be included during the install process and not on a separate page which has led to me scrabbling for answers (I'm also fully aware that this could just be a case of me being a bad user, so these are only suggestions). Also, on that note, since there is already a specific page for the Caveats of Windows, it might serve the user to have this page extended with common windows debugging solutions.

The one nuance that drove me loopy was not knowing that I'd need to update the host files (this made me second guess the whole install process). Annoyingly (and this might be me being a bad user), I did notice that it had prompted me to do so after the craft create X & 'craft apply' - but this information was lost so maybe more hierarchy can be given to it.

image

this was compounded by the details regarding the host file being mixed in with Certificates, I think separating these two out into two points and emphasizing when you'd be prompted to edit the host files would help (maybe?):

image

Thanks again for touching base, I really apricate you taking the time and fully acknowledge that I might be totally wrong on the points above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants