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.


1136 posts

Uber Geek
+1 received by user: 102

Subscriber

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

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
266 posts

Ultimate Geek
+1 received by user: 67


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

> 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).


965 posts

Ultimate Geek
+1 received by user: 175

Trusted

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

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





helping others at dev.icqz.net



1136 posts

Uber Geek
+1 received by user: 102

Subscriber

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

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.


266 posts

Ultimate Geek
+1 received by user: 67


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

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 

 

 




1136 posts

Uber Geek
+1 received by user: 102

Subscriber

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

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 ?

 

 


3148 posts

Uber Geek
+1 received by user: 883

Trusted

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

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.

 


344 posts

Ultimate Geek
+1 received by user: 130

Subscriber

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

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 :)

 

 




1136 posts

Uber Geek
+1 received by user: 102

Subscriber

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

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.


319 posts

Ultimate Geek
+1 received by user: 77

Trusted

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

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)

 

 




1136 posts

Uber Geek
+1 received by user: 102

Subscriber

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

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:





News »

N4L helping TAKA Trust bridge the digital divide for Lower Hutt students
Posted 18-Jun-2018 13:08


Winners Announced for 2018 CIO Awards
Posted 18-Jun-2018 13:03


Logitech Rally sets new standard for USB-connected video conference cameras
Posted 18-Jun-2018 09:27


Russell Stanners steps down as Vodafone NZ CEO
Posted 12-Jun-2018 09:13


Intergen recognised as 2018 Microsoft Country Partner of the Year for New Zealand
Posted 12-Jun-2018 08:00


Finalists Announced For Microsoft NZ Partner Awards
Posted 6-Jun-2018 15:12


Vocus Group and Vodafone announce joint venture to accelerate fibre innovation
Posted 5-Jun-2018 10:52


Kogan.com to launch Kogan Mobile in New Zealand
Posted 4-Jun-2018 14:34


Enable doubles fibre broadband speeds for its most popular wholesale service in Christchurch
Posted 2-Jun-2018 20:07


All or Nothing: New Zealand All Blacks arrives on Amazon Prime Video
Posted 2-Jun-2018 16:21


Innovation Grant, High Tech Awards and new USA office for Kiwi tech company SwipedOn
Posted 1-Jun-2018 20:54


Commerce Commission warns Apple for misleading consumers about their rights
Posted 30-May-2018 13:15


IBM leads Call for Code to use cloud, data, AI, blockchain for natural disaster relief
Posted 25-May-2018 14:12


New FUJIFILM X-T100 aims to do better job than smartphones
Posted 24-May-2018 20:17


Stuff takes 100% ownership of Stuff Fibre
Posted 24-May-2018 19:41



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.