Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
My domain is: saturn.tyrc.edu.tw
I ran this command: sudo certbot --nginx
It produced this output: Could not automatically find a matching server block for saturn.tyrc.edu.tw. Set the server_name directive to use the Nginx installer.
My web server is (include version): nginx/1.21.3
The operating system my web server runs on is (include version): Ubuntu 20.04.3 LTS
My hosting provider, if applicable, is: I don't know
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): no
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 1.20.0
I have checked my config file in /etc/nginx/sites-available and created link to /etc/nginx/sites-enabled, then restart nginx. But I still got this error.
Is there any problem in my config file? or something wrong?
and then I try to modified my config content that I was suggested
server {
root /var/www/109work/public;
server_name saturn.tyrc.edu.tw;
index index.php;
location / {
# try_files $uri $uri/ /index.php?$query_string;
try_files $uri /index.php?$query_string;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
# PHP-FPM 的連接方式
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_connect_timeout 600;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/saturn.tyrc.edu.tw/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/saturn.tyrc.edu.tw/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 = saturn.tyrc.edu.tw) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name saturn.tyrc.edu.tw;
return 404; # managed by Certbot
}
and new error occur after typing restart nginx
$ sudo systemctl restart nginx
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
the error detail shows
$ journalctl -xe
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has successfully entered the 'dead' state.
十 12 17:50:44 saturn tracker-store[274852]: OK
十 12 17:50:44 saturn systemd[274697]: tracker-store.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has successfully entered the 'dead' state.
十 12 20:53:02 saturn sudo[276354]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
十 12 20:53:05 saturn sudo[276354]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Can I make sure the config file include vhost config now? Is there any problem in my config file?
Thanks for everyone. I solved my problem.
I summarize my problem in here.
First, my nginx config file didn't include my vhost config file.
I change my vhost config filename than encounter another error when restart nginx.
The unit UNIT has successfully entered the 'dead' state.
十 12 20:53:02 saturn sudo[276354]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory