My domain is: hflswall.com
My web server is (include version): nginx/1.18.0
The operating system my web server runs on is (include version): CentOS Linux 7
My hosting provider, if applicable, is: not known in English-speaking countries, so please just ignore
I can login to a root shell on my machine (yes or no, or I don't know): yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel): yes, but not cpanel
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you're using Certbot): certbot 1.22.0
I ran this command:
Almost exactly following Certbot Instructions | Certbot, but when running sudo ln -s /snap/bin/certbot /usr/bin/certbot I got an error, then I realized I'm running my Wordpress site on a so-called lighthouse server, so nginx wasn't installed under the default path. Exact outcome as below:
[root@VM-8-8-centos ~]# sudo ln -s /snap/bin/certbot /usr/bin/certbot
[root@VM-8-8-centos ~]# sudo certbot --nginx
ERROR: ld.so: object '/$LIB/libonion.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')
[root@VM-8-8-centos ~]# service nginx status
nginx (pid 2000 1999 1996) already running.
[root@VM-8-8-centos ~]# locate nginx.conf
/www/server/nginx/conf/nginx.conf
/www/server/nginx/conf/nginx.conf.default
/www/server/nginx/src/conf/nginx.conf
Hence, I ran this instead:
sudo certbot --nginx --nginx-server-root /www/server/nginx/conf
Then it worked fine, until I saw --
Which names would you like to activate HTTPS for?
1: wordpress.local
My domain wasn't showing. Then I canceled the process and edited /www/server/nginx/conf/nginx.conf
The original .conf file was:
user www www;
worker_processes auto;
error_log /www/wwwlogs/nginx_error.log crit;
pid /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
multi_accept on;
}
http
{
include mime.types;
#include luawaf.conf;
include proxy.conf;
default_type application/octet-stream;
server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;
server_tokens off;
access_log off;
server
{
listen 888;
server_name phpmyadmin;
index index.html index.htm index.php;
root /www/server/phpmyadmin;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /www/wwwlogs/access.log;
}
include /www/server/panel/vhost/nginx/*.conf;
}
I then changed listen 888; server_name phpmyadmin;
into listen 80; server_name hflswall.com www.hflswall.com;
(I checked that nginx was listening both port 80 and 888 via netstat -nlp | grep nginx
)
Back to the certbot, everything worked seemingly fine. (Here, my site was still working.)
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: hflswall.com
2: www.hflswall.com
3: wordpress.local
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1, 2
Requesting a certificate for hflswall.com and www.hflswall.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/hflswall.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/hflswall.com/privkey.pem
This certificate expires on 2022-04-24.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for hflswall.com to /www/server/nginx/conf/nginx.conf
Successfully deployed certificate for www.hflswall.com to /www/server/nginx/conf/nginx.conf
Congratulations! You have successfully enabled HTTPS on https://hflswall.com and https://www.hflswall.com
But alas! My site is showing 404 Error now. I check SSL Server Test: hflswall.com (Powered by Qualys SSL Labs) and it shows no problem. Can anyone please help me? I just released my site to the public yesterday and got a hundred users so I'm really frustrated now.