I’m using CentOS 8 with Apache. This server hosting a WordPress website and I want to prepare it for HTTPS.
I have some questions and I’m thankful if people here, answer to them:
1- Linux by default using “localhost.localdomain”, is it an important name and must I change it to my domain name? I asked it because of “Mismatch” error like below:
If I want to change it then for a web site with the name “example-test.net” and “192.168.1.2” IP address, what is the content of “/etc/hostname” and “/etc/hosts” files? Is below configuration OK?
# cat /etc/hostname #localhost.localdomain example-test.net
# cat /etc/hosts #127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.2 example-test.net example-test
The /etc/hosts is an operating system file that translate hostnames or domain names to IP addresses. This is useful for testing websites changes or the SSL setup before taking a website publicly live. The /etc/hostname contains name of the machine, as known to applications that run locally.
I think these are important files. Thus my “hosts” file must the domain name with its suffix? “example-test.net” not “example-test” ?
2- Certbot need “localhost.crt” and “localhost.key” files, If “/etc/pki/tls/private/localhost.key” and
“/etc/ssl/certs/localhost.crt” files deleted then how can I regenerate them? Is below command OK?
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt
It is a great help if anyone answer my questions by number.