Question

Temporary test domain name or way to achieve this

Hi I created a multi install with a single website and was able to do that because there was a working IP address. Now I have 1 site there however I can’t use the ip address (or can I) to go to the NEW folder for the new site to test. In previous hosting scenarios I was able to turn on what was called a testing url which gave access to a folder. I tried this in my sites-available block…rewrite ^caribbean-diving.com/newsite$ var/www/newsite.com redirect; This didn’t work as the old site just 404’d

I have also tried to edit the /sites-available/digitalocean file which as I understand is the default from my one click install of LEMP. So I thought this could be the file the dedicated IP address could root through first…so I pointed the root directive to my new sites folder of that but it didn’t do anything and I still get to my initial website.

How to achieve this? Thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

A better option might be to simply create a symbolic link.

A symbolic link is part of your file system (nothing to do with Apache or nginx).

It creates a “virtual” directory which maps to a directory elsewhere in the file system.

You would run this via the command line (make sure the newsite folder doesn’t already exist):

ln -s /var/www/newsite.com /var/www/caribbean-diving.com/newsite

This creates a “vitual” link under /var/www/caribbean-diving.com/newsite which maps to /var/www/newsite.com

Anyone visiting http://caribbean-diving.com/newsite will see the contents of /var/www/newsite.com

Out of interest what operating system are you using locally on your own computer?

If you’re using Windows you can edit the file C:\Windows\System32\drivers\etc\hosts and add a line like this:

2.2.2.2 testdomain.com

Replace 2.2.2.2 with the IP address of your droplet.

testdomain.com will then map to your droplet from your local work station, bypassing any external DNS lookup.

Setup a new virtual host under sites-enabled.conf for testdomain.com and away you go.

In my case what seems to have been lacking is a default server and now it seems to be working and what @DigitalCarrot would have got had I posted my server block code…many thanks to you @DigitalCarrot

SO in my default site block I now have this

server {
        listen 80 default_server;
        listen [::]:80 default_server;

Vs

server {
        listen 80;
        listen [::]:80;

Now when I use the IP address remotely I can access what this default site points to…