I have a VPS running Ubuntu + Nginx. There’s an old website I’m no longer using, so I followed these steps (based on these instructions, and these to remove the SSL.
- cd /etc/nginx/sites-enabled
- sudo rm oldwebsite.com
- cd ../sites-available
- sudo rm oldwebsite.com
Next, I figured I could also delete the relevant files in /var/www/
- cd /var/www/
- sudo rm -r oldwebsite.com
Now when I try to access www.oldwebsite.com, I still get the same website, just without HTTPS anymore. I’ve checked /etc/nginx/sites-available/default for any remaining references to that website, but as far as I know, I’ve erased all traces of its existence from my server.
Was this the incorrect way to delete an old website?
If it helps, my old website was set up to use a reverse proxy to direct to my Express app. It was set up as a server block according to this guide.
2
Answers
So first of all if you dont want to make it accessable anymore delete the Host A record on your DNS. With this the DNS query will not point to any severs IP address.
Based on your comment: If its showing the APACHE defaults page your DNS points to an IP address of an webserver running httpd. So let me draft a couple of steps for you how I would do it (as somebody how moved 10K of sites from and to NGINX).
1. DNS is key
Check the current DNS Setting for your domain. Do a quick lookup using tools like
host
ordig
.So great now we know the public IPv4 of our WebServer (we are not talking about LoadBalancers or anything else in between. We asume the webserver is directly conncted to the internet.)
2. WebServer configuration
On your server make sure nginx is installed and listening on port 80 for example.
Great. We have NGINX listen on Port 80. Let make sure we can send reuqest.
So if you got an response that means your NGINX is up and running, listening on port 80 and there is no firewall (ufw, firewalld, iptables, security-groups…) blocking your from reaching out to the server.
NOTICE: Make sure your firewall setup is done right. Let me know if you need more information on that depending on your systems architecture.
NGINX Configuration
Lets say your website should just print out a String saying "We will be here shortly!"
Based on your OS the configuration directory for custom nginx files can be different. Check the default
/etc/nginx/nginx.conf
file and see theinclude
path in thehttp
context. This should be something like:include conf.d/*.conf
orsites-enabled/*.conf
. Create a conf-file in one of that directories.With this simple setup you can have a webserver up and running but not showing anyhing special. If you want to create a little html file feel free to do so and use
root
andindex
to configure it in your nginx configuration.After deleting enter command
sudo systemctl restart nginx