Score:0

Cannot access my website

hu flag

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))

in flag
The log messages are for a different server block than the one you are showing.
Laughing Laugh wwwwwww avatar
hu flag
What files or logs should I show?
in flag
Entries related to `/var/www/example`, not `/var/www/mail`. Or the configuration for `/var/www/mail`. The actual error messages your client shows (not your interpretation of it) when you try to access the site could also be helpful.
Laughing Laugh wwwwwww avatar
hu flag
After I removed ```sites-available/mail``` (with its symlink) there were no more 403 and 404 errors but there are ```signal process started```errors instead. Browser shows ```ERR_CONNECTION_REFUSED``` error.
in flag
`connection refused` usually indicates that the service is not running.
Laughing Laugh wwwwwww avatar
hu flag
I tried ```sudo systemctl start nginx``` and there were no errors but I still cannot access my website I also reloaded nginx with no errors either
in flag
Run `sudo ss -tnlp|grep :80` to check if something is listening on that port; check if your DNS entry resolves to the correct IP address; Confirm that you are trying to access the server via http and not https.
Laughing Laugh wwwwwww avatar
hu flag
Output of ```sudo ss -tnlp | grep :80``` shows that 80 port is used by nginx if I am not mistaken
in flag
Please, edit all additional information into your question. It's much more readable there than in the comments.
Laughing Laugh wwwwwww avatar
hu flag
I tried ```certbot --nginx``` and everything started working but browser cannot access ```styles.css``` with ```Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID``` error
in flag
That should be a new question. But before you ask it, inspect the certificate that your server delivers and check your configuration for the certificates that are used.
Laughing Laugh wwwwwww avatar
hu flag
How should I do that? Is this question to be closed?
Score:0
in flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.