Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


1180 posts

Uber Geek
+1 received by user: 111

Subscriber

Topic # 236349 29-May-2018 13:41
Send private message

At least that's what I think I want to do ! I'm having a mental block day today.

 

When I redo a website I typically setup a dev site on a Vultr server, update my hosts file and away I go. But this time I want to be able to access the dev site from other PC's without having to update the hosts file.

 

Is it possible to create a subdomain on my own site (say dev.blah.com) and have that redirect to a subdirectory on Vultr under a different domain name ? I have a Vultr server with a number of other websites on it already but just want to work out if it can be done.

 

Or is there a better way of doing it ?

 

I thought of just buying a domain name and building it on that, but it seems a waste of a domain if I can redirect a subdomain (or something).

 

[e]

 

I'll try to explain it again.

 

An existing website (domain.com) is hosted somewhere and I have access to neither the DNS or web hosting.

 

I have a Vultr server with a couple of other sites and my own site is blah.com.

 

Can I create a dev version of domain.com on Vultr and point dev.blah.com to it somehow ?


Create new topic
454 posts

Ultimate Geek
+1 received by user: 116


  Reply # 2024843 29-May-2018 14:22
Send private message

> An existing website (domain.com) is hosted somewhere and I have access to neither the DNS or web hosting.

 

> Can I create a dev version of domain.com on Vultr and point dev.blah.com to it somehow ?

 

If you don't have access to the DNS, then you won't be able to create the DNS record for dev.blah.com. Once you have solved that problem, setting it up to point to a subdirectory is a relative easy (assuming you are using Apache or Nginx as the web server).


1047 posts

Uber Geek
+1 received by user: 215

Trusted

  Reply # 2024845 29-May-2018 14:23
Send private message

I just keep it simple and use subdir from my domain.





helping others at evgenyk.nz




1180 posts

Uber Geek
+1 received by user: 111

Subscriber

  Reply # 2024852 29-May-2018 14:30
Send private message

stinger:

 

> An existing website (domain.com) is hosted somewhere and I have access to neither the DNS or web hosting.

 

> Can I create a dev version of domain.com on Vultr and point dev.blah.com to it somehow ?

 

If you don't have access to the DNS, then you won't be able to create the DNS record for dev.blah.com. Once you have solved that problem, setting it up to point to a subdirectory is a relative easy (assuming you are using Apache or Nginx as the web server).

 

 

I don't have access to DNS or hosting for domain.com but I do have DNS access to blah.com.

 

I think I've just worked it out. I'd created the subdomain dev.blah.com and updated the A record to point to the IP address of the Vultr server but hadn't restarted nginx on Vultr once I had created dev.blah.com. I did that, cleared the Chrome cache and it worked :)

 

What I would like to know now is, can I create domain.com on Vultr and have dev.blah.com point to it. Mimicking the updating of a hosts file to point to a different IP address.


454 posts

Ultimate Geek
+1 received by user: 116


  Reply # 2024861 29-May-2018 14:41
Send private message

martyyn:

 

What I would like to know now is, can I create domain.com on Vultr and have dev.blah.com point to it. Mimicking the updating of a hosts file to point to a different IP address.

 

 

Yes. There are two approaches:

 

1) The easiest is to set up a virtual host. This will only work if there are no mentions to https://domain.com in your HTML/JS/CSS.

 

2) Failing that, you can set up a virtual host, and use proxypass (and set up domain.com in your hosts file on the Vultr VM). This ensures that any reference to https://domain.com/ will be re-written to https://dev.blah.com/ . I haven't tried this with nginx, but a quick Internet search indicates it should work. e.g. https://stackoverflow.com/questions/32542282/how-do-i-rewrite-urls-in-a-proxy-response-in-nginx 

 

 




1180 posts

Uber Geek
+1 received by user: 111

Subscriber

  Reply # 2024925 29-May-2018 15:39
Send private message

stinger:

 

2) Failing that, you can set up a virtual host, and use proxypass (and set up domain.com in your hosts file on the Vultr VM). This ensures that any reference to https://domain.com/ will be re-written to https://dev.blah.com/ . I haven't tried this with nginx, but a quick Internet search indicates it should work. e.g. https://stackoverflow.com/questions/32542282/how-do-i-rewrite-urls-in-a-proxy-response-in-nginx 

 

 

Brilliant, thanks.

 

I'm almost there, this gets me to the home page of domain.com on my Vultr server, but clicking on any of the new links sends me to the existing version of domain.com rather than stay on my Vultr version. I'll do some more reading.

 

Is what I want to do possible or am I trying to do something the hard way ?

 

 


3209 posts

Uber Geek
+1 received by user: 916

Trusted

  Reply # 2024960 29-May-2018 16:25
One person supports this post
Send private message

relative paths?

 

 

 

Also, would a CNAME not do for this, or am I missing something?

 

 

 

 

What I would like to know now is, can I create domain.com on Vultr and have dev.blah.com point to it. Mimicking the updating of a hosts file to point to a different IP address.

 


389 posts

Ultimate Geek
+1 received by user: 149

Subscriber

  Reply # 2025006 29-May-2018 16:51
One person supports this post
Send private message

As you have access to the DNS setup of blah.com, why not just set up a CNAME record pointing at the site on the Vultr server. 

 

It also looks like you are using absolute path names in your links. ie including http://domain.com/ as part of the url. This will cause you a lot of pain :)

 

 




1180 posts

Uber Geek
+1 received by user: 111

Subscriber

  Reply # 2025407 30-May-2018 10:20
Send private message

My understanding of CNAME is it's nothing more than an alias and will point dev.blah.com to domain.com on the original host rather than domain.com on Vultr.

 

I'll do some more reading around proxy_pass today and see where I get to.


327 posts

Ultimate Geek
+1 received by user: 77

Trusted

  Reply # 2025409 30-May-2018 10:27
Send private message

In general we have a domain that we use for only for development /qa /staging

we just add a wildcard for the DNS at the then can set up sites easily as we need them

ie

- sitedomain-dev.testdomain.nz
- sitedomain-qa.testdomain.nz
- sitedomain-staging.testdomain.nz
- sitedomain.nz (live site)

 

 




1180 posts

Uber Geek
+1 received by user: 111

Subscriber

  Reply # 2030027 5-Jun-2018 19:16
Send private message

Killerkiwi2005:

 

In general we have a domain that we use for only for development /qa /staging

 

This is what I ended up going with. I think I was just trying to be too clever initially :(


Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.