By Calvin Crane
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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
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
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…
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.