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.


martyyn

1971 posts

Uber Geek

ID Verified

#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
stinger
628 posts

Ultimate Geek
Inactive user


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




kobiak
1615 posts

Uber Geek

Trusted

  #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


martyyn

1971 posts

Uber Geek

ID Verified

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




stinger
628 posts

Ultimate Geek
Inactive user


  #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 

 

 


martyyn

1971 posts

Uber Geek

ID Verified

  #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 ?

 

 


sidefx
3711 posts

Uber Geek

Trusted

  #2024960 29-May-2018 16:25
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.

 





"I was born not knowing and have had only a little time to change that here and there."         | Octopus Energy | Sharesies
              - Richard Feynman


djtOtago
1149 posts

Uber Geek


  #2025006 29-May-2018 16:51
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 :)

 

 


 
 
 

Move to New Zealand's best fibre broadband service (affiliate link). Note that to use Quic Broadband you must be comfortable with configuring your own router.
martyyn

1971 posts

Uber Geek

ID Verified

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


Killerkiwi2005
374 posts

Ultimate Geek

Trusted

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

 

 


martyyn

1971 posts

Uber Geek

ID Verified

  #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





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.