Hi everyone,
I’m thinking of changing the name of the blog and the main domain. Could you explain the correct procedure for changing the configuration in ghost anywhere? And how to solve with SEO?
I use the latest version of ghost (1.22.1)
I know how to implement redirect 301 in the actual_domain-ssl.conf file in: /var/www/ghost/system/files
I’m not sure to remember the correct command to get ssl certificates for the new domain
Can you suggest me how to proceed correctly for ghost?
The main thing you’ll want to do is ensure that every one of your posts/pages has a 301 redirect and that robots.txt and the sitemap files are redirected too. If you are only changing the domain name this should be fairly simple with a single redirect rule.
The other thing you may need to do is to ensure sure any links or images in your post content that are stored as absolute URLs get updated. One way to do that would be to export your content, run a search and replace on it, then import into an empty blog.
I’m not sure I’m using a robots.txt currently.
Only the domain and the tld are changing.
Is it not possible to change the domain without having to export the contents, make a replace, and import into a new blog?
The configurations for Nginx redirect should be these, I think they are correct:
ACTUAL_DOMAIN.it.conf
server {
listen 80;
listen [::]:80;
server_name www.ACTUAL_DOMAIN.it;
root /var/www/ghost/system/nginx-root;
include /etc/nginx/proxy.conf;
include /etc/nginx/acme.conf;
client_max_body_size 50m;
}
ACTUAL_DOMAIN.it-ssl.conf
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ACTUAL_DOMAIN.it;
ssl_certificate /home/user/.acme.sh/ACTUAL_DOMAIN.it/fullchain.cer;
ssl_certificate_key /home/user/.acme.sh/ACTUAL_DOMAIN.com/ACTUAL_DOMAIN.it.key;
include /var/www/ghost/system/files/ssl-params.conf;
return 301 https://NEW_DOMAIN.it$request_uri;
include /etc/nginx/acme.conf;
client_max_body_size 50m;
}
Theoretically, even the files have to change their names, because as a name they have the current domain that will change.
All i need for ghost config is ghost config url new_url ?
With ghost config url new_url I change the blog url, but I will not change the name in the configuration files?
What you’re doing here is telling ghost that your blog is not at {old_url} but is at {new_url} You don’t want to change the name of the configuration files because they were generated specifically for {old_url}, rather you want to create new ones. This will leave the old configuration files, which (specifically for nginx) can allow you to configure things for {old_url}.
Then ghost setup ssl I do not need it? I’m not changing the subdirectory, I have to completely change the name of the blog, url, domain and tld
In this case, you do need to setup ssl NGINX. What this will do is update the nginx configuration to properly respond to requests from {new_domain} as well as get an SSL certificate from LetsEncrypt.
Note: I accidentally wrote ghost setup ssl instead of ghost setup nginx. You need to run ghost setup nginx, which will internally run ghost setup ssl. The SSL step is a subset of the NGINX step. Summary: run ghost setup nginx, not ghost setup ssl
If you’re trying to change the name of your blog, check out the support docs
Great, so ghost nginx setup, it should do everything automatically? Update nginx with the new domain, redirect, and ssl certificates?
It will not add the redirect, you need to do that manually. I would advise doing it before you run ghost setup nginx (note you flipped the terms earlier ) since running that command will tell nginx to reload its configuration!
Well, I think everything is clear, I need to ask you one last question.
I have not personally installed Nginx the first time.
I noticed that in the configuration there is already an old domain and a redirect to the current one. There are two server blocks, one for each domain, each block server includes ssl certificates.
Do I need to get the ssl certificates even for the old domains with the new 301 redirect?
Or can I create a server block with the old domain that can redirect 301 to the new one without including the certificates?
This configuration for the new configuration do you think is correct?
After the ghost setup nginx command to insert the new url and get the certificates, will I continue to get the certificates for the old domains? because the old domains will still be directed to the blog, I need all the certificates for the https
Thanks, the certificates are properly working
I thought it was part of ghost setup nginx as we said in previous posts.
Can I delete old_domain.conf and old_domain-ssl.conf and set a redirect in new files (new_domain.conf and new_domain-ssl.conf) or can not I delete them?
EDIT:
The new certificates were not created in /home/giacomo/.acme.sh/
but in: /etc/letsencrypt/
The certificates for the www version were missing.
So I gave ghost a new URL with www and installed the new certificates, I redid the whole procedure, now everything is working, I do not know if I did well, but now have generated two new files in ghost/system /files for the version with www.
ghost install and ghost setup automatically ask if we want ssl after the nginx stage. Not sure if doing just ghost setup nginx also asks or not. In any case, the optional ssl stage requires a previous nginx stage.
As Vikas suggested, and I agree, it’s a good practice to have an Nginx file or symlink for each domain in the sites-enabled folder. Anyway, probably you have this line in your /etc//nginx/nginx.conf file:
include /etc/nginx/sites-enabled/*;
So I guess it’s possible to merge files, although I’ve not tried that. It’s more ordered and it’s working well as they said you.
Thanks, I thought it was more correct to merge the files to get the neater code.
I will follow your advice and leave the files separate.
I can consider my “problem” solved thanks to everyone’s help
Those are the old server’s IP and server_name. Usually the port is enough (listen 80 or listen 443), but sometimes including the IP fixes some problems.
That’s a 301 permanent redirect, with traffic arriving at the old address immediately redirected to the new address.
I’ve updated the redirection example on the other thread, with more details on files, etc.