Nginx fails to start after installing the CertBot certificate

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: devmodel.atopicappserver.ru

I ran this command: sudo systemctl status nginx

It produced this output:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Sat 2021-04-17 13:14:31 UTC; 10min ago
Docs: man:nginx(8)
Process: 1450 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1449 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Apr 17 13:13:01 dev systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 17 13:13:01 dev systemd[1]: nginx.service: Can't open PID file /run/nginx.pid (yet?) after start: No such file or directory
Apr 17 13:14:31 dev systemd[1]: nginx.service: Start operation timed out. Terminating.
Apr 17 13:14:31 dev systemd[1]: nginx.service: Killing process 1451 (nginx) with signal SIGKILL.
Apr 17 13:14:31 dev systemd[1]: nginx.service: Killing process 1452 (nginx) with signal SIGKILL.
Apr 17 13:14:31 dev systemd[1]: nginx.service: Failed with result 'timeout'.
Apr 17 13:14:31 dev systemd[1]: Failed to start A high performance web server and a reverse proxy server.

My web server is (include version): nginx/1.14.0 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 18.04.5 LTS

My hosting provider, if applicable, is:

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.14.0

When running $sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

$ cat nginx.conf
user root root;
worker_processes 1; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;

events {
worker_connections 4096; ## Default: 1024
}

http {

include conf/mime.types;

include /etc/nginx/proxy.conf;

include /etc/nginx/fastcgi.conf;

index index.html index.htm index.php;

default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts

server { # php/fastcgi
server_name devmodel.atopicappserver.ru www.devmodel.atopicappserver.ru;
access_log logs/domain1.access.log main;
root html;

listen 6002 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/devmodel.atopicappserver.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/devmodel.atopicappserver.ru/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
    location / {
            proxy_pass http://127.0.0.1:6004;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
    }

}
server {
if ($host = devmodel.atopicappserver.ru) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name devmodel.atopicappserver.ru www.devmodel.atopicappserver.ru;
return 404; # managed by Certbot
}
}

I am trying to use nginx to
(1) receive a post request to https://devmodel.atopicappserver.ru/some-path/?my_parameter='some value'
(2) forward request to http://127.0.0.1:6004/some-path/?my_parameter='some value'
(3) Return the request to client.

Thank you in advance for your help.

1 Like

Welcome to the Let's Encrypt Community, Stepan :slightly_smiling_face:

Let's see if we can find the cause.

What is the output of this?

sudo nginx -T

Please post the output with 3 backticks above and below, like this:

```
output
```

1 Like

Does this file exist?:

Have you rebooted the server?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.