Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Jenny Swift
Jenny Swift
21,999 Points

How to switch web hosts? I'm getting errors.

Hi, so until now I have been using Web Hosting For Students (which uses cPanel), and now that I'm using Laravel I decided to switch to DigitalOcean and Forge because that is what is used in the Laracasts.

But I'm not sure how to stop my existing web hosting from conflicting with my new one. When I tried to load my page after setting up with DigitalOcean and Forge, it gave me an error that looked like there was a conflict.

So I did lots of googling but didn't find any clear information on how to unregister a domain from cPanel. (Temporarily would be ideal, in case I change my mind.)

So then I tried to delete everything from my cPanel with my FTP client. Some things it hasn't allowed to be deleted. And after deleting everything from public_html I'm getting the following errors:

The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any help please?

3 Answers

Hey Jenny,

Sorry to hear about the complications. I'm having trouble understanding the problem. Could you clarify if you are trying to change the DNS or migrate a web application? If you just need to point the domain name at a new server, then your problems are at the DNS level.

You are obviously attempting to move a site from serverA(web hosting for students) to serverB(DigitalOcean). Assuming the new server is configured properly and runs PHP (most do), there really should be no conflict if you just migrate the site to the new host and point your domain name at the new host's nameservers, although it occasionally takes several hours to propagate. If you know the IP address for your Digital Ocean server, you could type that in as the URL to see if the your web app is functional on the new host.

Also, if you used an FTP to delete everything in the public directory from the server at Web Hosting for Students, then 404 errors will be expected behavior for any URL formerly on that host.

Hope this helps! Comment back if you have any questions.

Jenny Swift
Jenny Swift
21,999 Points

Hi Stephen, I really appreciate the reply!

So to clarify: I want the domain name to remain the same as it was. So if my site was www.example.com, I still want it to be that. I'm not sure the difference between a Domain Name System and a domain name, so I hope that clarifies.

Also, I'm just trying to get the app I have created, that is working locally, to work on my production site. I had the app working on my production site with my old host before I switched to Laravel, before I switched hosts. Sorry I'm not sure if that is called a web application migration but I hope I have described it clearly this time.

So I think the way you put it, pointing the domain name at a new server, is describing what I want.

As far as I understand, I have pointed the domain name at my new server, but it is also still pointed at my old server. So I suppose the domain name doesn't know which server to point to?

If I type the IP address in as the URL I get a 404 not found error.

"Also, if you used an FTP to delete everything in the public directory from the server at Web Hosting for Students, then 404 errors will be expected behavior for any URL formerly on that host."

But the URL I was using while on that host is the same URL I'm using for my app with the new host. So I'm not sure how to stop the 404 error.

I am now seeing an error that may provide useful information, although I don't know how to go about fixing it. On Forge when I click the 'Deploy Now' button and then the 'View Latest Deployment Log' button, it shows me this:

/home/forge/.forge/provision-1051792.sh: line 1: cd: /Users/2013/Homestead/Projects /my_app: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
Composer could not find a composer.json file in /home/forge
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Could not open input file: artisan

If I click on the 'Edit Deploy Script' button, it displays this:

cd /Users/2013/Homestead/Projects/my_app git pull origin master composer install php artisan migrate --force

Thinking the problem may be with the path on the first line, I have tried changing it a few times to what I thought it might be, and each time I received the same error.
The first line, by default, was:
cd /home/forge/mysite.com

I'm not really sure what the first line is trying to achieve, actually, because I've linked my Bitbucket repository to my site on Forge, so I thought it was supposed to pull from that, not from the folder on my computer.

Jenny Swift
Jenny Swift
21,999 Points

Hmm, just thinking, I wonder if it's not working because maybe there is something else I need to set up in DigitalOcean, like maybe an access token. It's late night here though so I won't look at it now but I thought I should add that in case it's a possibility.

Okay, I think I understand. In full disclosure I don't usually develop on the Larvel framework and I have never used forge, but I will help you troubleshoot this to the best of my ability.

There are two issues here, DNS (propagation) and Hosting (migration).

When you move files and documents from one server to another, that is called migration. This involves a host, like Digital Ocean. Hosts have unique ID numbers called IP addresses. Specific servers may be virtual, shared or dedicated, but regardless they will have nameserver addresses (usually two).

Domain Name Servers (DNS) associate an IP address and a NameServer at that IP to a URL. Domains are different than hosts and can be purchased at a registrar like GoDaddy. Changing DNS servers to direct a domain name to new servers is called propagation. So a host stores your application or website, and a Domain Name translates the IP address into a word so people can find it.

DNS

We need to know what server your domain is directed to. this link is an easy way to figure that out. When you signed up for hosting at Digital Ocean, you should have received some documentation that told you what your nameservers (there should be 2) are and what IP address they are located at. What's My DNS will definitively answer that question. If the domain name points at the old IP address or errors, then you have a problem at the Domain level and you need to correct it with your registrar. If you google your registrar's name and "change DNS" you should find step by step instructions.

Once we have established that your domain name is directed at your intended production server (Digital Ocean), you can address the 404 errors.

I could take a swing at that, but honestly you'd be better off asking someone like Hampton Paulk. He is extremely talented in this area and probably has some experience with Forge.

Good Luck!

Jenny Swift
Jenny Swift
21,999 Points

I found your explanations really helpful, thank you very much!

So I think I've made a lot of progress although there's still more to do.

It looks like my domain is now pointed to DigitalOcean. So I think that conflict is resolved. I received support from Web Hosting for Students telling me how to do it, and I also added the domain to DigitalOcean. I had trouble getting whatsmydns.net to work so I ended up using pingdom instead. And it is telling me my nameservers are the DigitalOcean nameservers, so that looks fine.

I was still getting the deploying error, and after help from Forge support, it seems I have that fixed now. I think I just had the path in the first line of the deploy script wrong.

However, now when I go to my site it just says 'No input file specified.' Also, when I type my IP address as the URL, I still get a 404 not found error.

I thought the following information may be relevant:

When I enter my domain name into whois, next to 'status', it says:

clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited

I'm not sure what that means but it looks like something could be wrong there.

Also, when I used pingdom, in the SOA (not sure what that stands for) section, it had these warnings:

It couldn't find the reverse address for my IP address
Delivery over IPv4 to hostmaster@mysite.com could not be done.
Failed to deliver email for SOA RNAME of mysite.com (hostmaster.mysite.com) using hostmaster@mysite.com (That one doesn't sound relevant, but I included it just in case.)

Jenny Swift
Jenny Swift
21,999 Points

I just checked out the 'clientTransferProhibited' status by following the link and I don't think it looks like a problem.

Jenny Swift
Jenny Swift
21,999 Points

Well the good news is my site is finally working!! :)

The funny thing is I'm not sure what I did to get it to work. I asked Forged support about my 'No input file specified' error and received the following response:

'That typically means the public directory when the site was created does not match the location of the index.php file.'

So I fiddled around, deleting my site from Forge and adding it again with different paths. Eventually my site displayed properly when I thought I had the same setup I had before!

I'm still getting the 404 error when I enter my IP address as the URL though. That seems strange. Do you think it matters though? And I'm still getting the same warnings from pingdom. Do you think they matter?

It's so nice to have my site working now though...finally! :)

ClientTransferProhibited means that you can't move the domain name from one registrar to another--that's fine. I don't know why accessing it via the IP address directly would not work. Maybe something to do with shared hosting?? If the URL works, then DNS resolves to the correct IP and the host serves the page, I might not worry about it.

I'm really glad to hear you have it mostly sorted--You would be amazed how many times I see forum posts that resolve with "IDK what happened but it started working..." Persistent fiddling can be very effective troubleshooting and you always learn a lot.

In any event, this thread will probably be useful to others in the future. I noticed there was a new course on Laravel out, I might have to check it out.

Good Luck!

Jenny Swift
Jenny Swift
21,999 Points

Time for another update! This one's a strange one...

So as you know I had it working. I didn't use my site for a little while. I don't remember changing anything. I loaded my site again and, once again, my app wasn't displaying, and instead it was displaying I think as if it was still pointing to Web Hosting for Students! I checked and my domain was still pointed at the DigitalOcean nameservers. So I decided it was time to buy a new domain name. No problems with the new one so far... :)

'You would be amazed how many times I see forum posts that resolve with "IDK what happened but it started working..."'

lol :) And now I don't know what happened but it started not working again. But yes, I am learning a lot and I hope others do benefit from this post, too.

Thanks again for your help! :) And I hope you enjoy the new Laravel course.