0

everyone! I'm linux-enthusiast and I have an issue with an nginx on debian VPS. Until recently I could access my static website but now I can't.

This is my sites-available/example where example is my username:

server {
        listen 80 ;
        listen [::]:80 ;
        server_name example.com ;
        root /var/www/example ;
        index index.html index.htm index.nginx-debian.html ;
        location / {
                try_files $uri $uri/ =404 ;
        }
}

sites-available/example has s symbolic link in sites-enabled

My nginx/error.log:

2021/12/07 08:57:02 [notice] 7383#7383: signal process started
2021/12/07 09:22:00 [notice] 2195#2195: signal process started

Before signal process started I had 403 or 404 errors:

2021/12/05 17:53:05 [emerg] 12400#12400: open() "/etc/nginx/sites-enabled/mail" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
2021/12/05 17:55:01 [emerg] 12415#12415: open() "/etc/nginx/sites-enabled/mail" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
2021/12/05 18:02:33 [emerg] 12468#12468: open() "/etc/nginx/sites-enabled/mail" failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
2021/12/05 18:05:15 [error] 12522#12522: *1 directory index of "/var/www/mail/" is forbidden, client: 212.16.10.194, server: mail.example.com, request: "GET / HTTP/1.1", host: "example.com"
2021/12/05 18:07:45 [error] 12562#12562: *1 directory index of "/var/www/mail/" is forbidden, client: 212.16.10.194, server: mail.example.com, request: "GET / HTTP/1.1", host: "example.com"

I even reinstalled nginx but I still have a problem with accessing to my website. What should I do or where should I search information to solve this issue?

sudo ss -tnlp|grep :80 shows this:

LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=2524,fd=6),("nginx",pid=2522,fd=6))

LISTEN 0 128 [::]:80 [::]:* users:(("nginx",pid=2524,fd=7),("nginx",pid=2522,fd=7))

1 Answers1

0

From the comments: nginx was only listening on port 80, but the OP was trying to access the site via https on port 443.

Running certbot --nginx added the necessary configuration to nginx to listen on port 443 as well.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79