First here is what I did on Ubuntu 16/nginx Digital Ocean droplet:
OLD_domain.com.au, all good.NEW_domain.com.au.NEW_domain.com.au is working.However I notice /etc/nginx/sites-enabled/default still has references to old domain. My question is can I just manually update this file with the new domain and restart nginx? Or is there a better way?
Here is the relavant bits of the file:
/* /etc/nginx/sites-enabled/default */
server {
...
server_name NEW_domain.com.au www.NEW_domain.com.au;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/NEW_domain.com.au/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/NEW_domain.com.au/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
...
server {
if ($host = www.accessmygp.com.au) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = accessmygp.com.au) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name accessmygp.com.au www.accessmygp.com.au;
listen 80;
return 404; # managed by Certbot
...
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!
Accepted Answer
I fixed this:
grep -ErI 'olddomain.com.au|newdomain.com.au' /etc/nginx/sudo nginx -t
sudo service nginx restart
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.