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.


1151 posts

Uber Geek
+1 received by user: 104

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

Ultimate Geek
+1 received by user: 94


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


978 posts

Ultimate Geek
+1 received by user: 179

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



1151 posts

Uber Geek
+1 received by user: 104

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.


348 posts

Ultimate Geek
+1 received by user: 94


  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 

 

 




1151 posts

Uber Geek
+1 received by user: 104

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 ?

 

 


3165 posts

Uber Geek
+1 received by user: 890

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.

 


360 posts

Ultimate Geek
+1 received by user: 136

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

 

 




1151 posts

Uber Geek
+1 received by user: 104

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.


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

 

 




1151 posts

Uber Geek
+1 received by user: 104

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 »

Intel introduces new NUC kits and NUC mini PCs
Posted 16-Aug-2018 11:03


The Warehouse leaps into the AI future with Google
Posted 15-Aug-2018 17:56


Targus set sights on enterprise and consumer growth in New Zealand
Posted 13-Aug-2018 13:47


Huawei to distribute nova 3i in New Zealand
Posted 9-Aug-2018 16:23


Home robot Vector to be available in New Zealand stores
Posted 9-Aug-2018 14:47


Panasonic announces new 2018 OLED TV line up
Posted 7-Aug-2018 16:38


Kordia completes first live 4K TV broadcast
Posted 1-Aug-2018 13:00


Schools get safer and smarter internet with Managed Network Upgrade
Posted 30-Jul-2018 20:01


DNC wants a safer .nz in the coming year
Posted 26-Jul-2018 16:08


Auldhouse becomes an AWS Authorised Training Delivery Partner in New Zealand
Posted 26-Jul-2018 15:55


Rakuten Kobo launches Kobo Clara HD entry level reader
Posted 26-Jul-2018 15:44


Kiwi team reaches semi-finals at the Microsoft Imagine Cup
Posted 26-Jul-2018 15:38


KidsCan App to Help Kiwi Children in Need
Posted 26-Jul-2018 15:32


FUJIFILM announces new high-performance lenses
Posted 24-Jul-2018 14:57


New FUJIFILM XF10 introduces square mode for Instagram sharing
Posted 24-Jul-2018 14:44



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.