Emergency help about my Web Site

Hello,
My WordPress website is not up after I changed the values of “hostname” and “hosts” files.
My web site name is “mydomain.net” ==> It is an example.
When I installed the CentOS 8, I left the domain setting default (localhost.localdomain) and I installed and configured the LAMP and Letsencrypt. Everything worked correctly till I changed my “hostname” and “hosts” files as below:

# cat /etc/hostname
#localhost.localdomain
mydomain.net

# cat /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

"My Server IP"  mydomain.net mydomain

After it my server show me “Your connection is not private” error and I can’t browse my website.
I googled and find a page that told it is because of “localhost.key” and “localhost.crt” files. because I changed the default hostname.
I removed these files and “certbot”:

# rm /etc/pki/tls/private/localhost.key
# rm /etc/ssl/certs/localhost.crt

And after it I used below command to generate a default key:

/usr/libexec/httpd-ssl-gencerts

And:

# openssl x509 -in /etc/ssl/certs/localhost.crt -noout -subject
subject=C = US, O = Unspecified, CN = mydomain.net, emailAddress = root@mydomain.net

This command, generated “localhost” files and I want to configure my Virtual Host from start.
In “httpd.conf”:

ServerName mydomain.net

And Virtual Host file is as below:

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName mydomain.net
DocumentRoot /var/www/wordpress
<Directory "/var/www/wordpress">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>

I installed the certbot:

# dnf install certbot python3-certbot-apache

Then:

# certbot --apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): info@mydomain.net

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mydomain.net
2: www.mydomain.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):   ===> "I hit Enter key"
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mydomain.net
http-01 challenge for www.mydomain.net
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/wp-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/wp-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/wp-le-ssl.conf
Redirecting vhost in /etc/httpd/conf.d/wp.conf to ssl vhost in /etc/httpd/conf.d/wp-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://mydomain.net and
https://www.mydomain.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Subscribe to the EFF mailing list (email: info@mydomain.net).

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mydomain.net/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mydomain.net/privkey.pem
   Your cert will expire on 2020-12-02. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

After it:

# systemctl restart httpd
# apachectl configtest
Syntax OK

And my Virtual Host config file became to:

<VirtualHost *:80>
ServerAdmin root@localhost
ServerName mydomain.net
ServerAlias www.mydomain.net
DocumentRoot /var/www/wordpress
<Directory "/var/www/wordpress">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log common
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.net [OR]
RewriteCond %{SERVER_NAME} =mydomain.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

When I browse my website then:


Apache log tell me:

]# cat /var/log/httpd/error_log
[Thu Sep 03 19:28:36.973820 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00493: SIGUSR1 received.  Doing graceful restart
[Thu Sep 03 19:28:37.085905 2020] [lbmethod_heartbeat:notice] [pid 456658:tid 140461237471552] AH02282: No slotmem from mod_heartmonitor
[Thu Sep 03 19:28:37.091499 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00489: Apache/2.4.37 (centos) OpenSSL/1.1.1c mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 03 19:28:37.091551 2020] [core:notice] [pid 456658:tid 140461237471552] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Sep 03 19:28:43.011100 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00493: SIGUSR1 received.  Doing graceful restart
[Thu Sep 03 19:28:43.124229 2020] [lbmethod_heartbeat:notice] [pid 456658:tid 140461237471552] AH02282: No slotmem from mod_heartmonitor
[Thu Sep 03 19:28:43.129813 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00489: Apache/2.4.37 (centos) OpenSSL/1.1.1c mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 03 19:28:43.129865 2020] [core:notice] [pid 456658:tid 140461237471552] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Sep 03 19:28:46.669732 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00493: SIGUSR1 received.  Doing graceful restart
[Thu Sep 03 19:28:46.778790 2020] [lbmethod_heartbeat:notice] [pid 456658:tid 140461237471552] AH02282: No slotmem from mod_heartmonitor
[Thu Sep 03 19:28:46.783707 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00489: Apache/2.4.37 (centos) OpenSSL/1.1.1c mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 03 19:28:46.783746 2020] [core:notice] [pid 456658:tid 140461237471552] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Sep 03 19:28:47.058568 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00493: SIGUSR1 received.  Doing graceful restart
[Thu Sep 03 19:28:47.166532 2020] [lbmethod_heartbeat:notice] [pid 456658:tid 140461237471552] AH02282: No slotmem from mod_heartmonitor
[Thu Sep 03 19:28:47.171438 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00489: Apache/2.4.37 (centos) OpenSSL/1.1.1c mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 03 19:28:47.171485 2020] [core:notice] [pid 456658:tid 140461237471552] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Sep 03 19:30:51.127973 2020] [mpm_event:notice] [pid 456658:tid 140461237471552] AH00492: caught SIGWINCH, shutting down gracefully
[Thu Sep 03 19:30:52.325040 2020] [core:notice] [pid 460651:tid 140567023769920] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu Sep 03 19:30:52.327359 2020] [suexec:notice] [pid 460651:tid 140567023769920] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Sep 03 19:30:52.330126 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/) configured.
[Thu Sep 03 19:30:52.330164 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: APR compiled version="1.6.3"; loaded version="1.6.3"
[Thu Sep 03 19:30:52.330173 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: PCRE compiled version="8.42 "; loaded version="8.42 2018-03-20"
[Thu Sep 03 19:30:52.330186 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: LUA compiled version="Lua 5.3"
[Thu Sep 03 19:30:52.330191 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: YAJL compiled version="2.1.0"
[Thu Sep 03 19:30:52.330196 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: LIBXML compiled version="2.9.7"
[Thu Sep 03 19:30:52.330201 2020] [:notice] [pid 460651:tid 140567023769920] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.
[Thu Sep 03 19:30:52.387610 2020] [lbmethod_heartbeat:notice] [pid 460651:tid 140567023769920] AH02282: No slotmem from mod_heartmonitor
[Thu Sep 03 19:30:52.396738 2020] [mpm_event:notice] [pid 460651:tid 140567023769920] AH00489: Apache/2.4.37 (centos) OpenSSL/1.1.1c mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 03 19:30:52.396802 2020] [core:notice] [pid 460651:tid 140567023769920] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

What is my mistake? How can I solve it?

Thank you.

1 Like

6 posts were merged into an existing topic: Install Let’s Encrypt SSL Certificate on CentOS 8