Question

Server blocks is not reached in some browsers

Posted November 22, 2020 464 views
LEMPInitial Server Setup

0

I have in the last week started with digitalocean droplet system and have set up my first droplet with LEMP stack while following Initial setup and Quickstart guide. I did remove the tag for the last configuration with the cloud firewall because I did not get it working. I then followed how to set up server blocks which worked pretty much fine with the exception that it doesn’t work on all web browsers.

On chrome it redirects to the default site but on firefox it goes through to the server block. I have tried to look this up on similar questions, fixing it with configuring the firewall, with no success. In /etc/nginx/sites-available there exists four files: mydomain.com, mydomain2.com, default and digitalocean (is digitalocean supposed to be here?). I checked each file to make sure the name server is unique and only one have default server.

I also noticed that when the ip address is in the search field the site says the connection is not secure but when domain.com is searched on chrome it is secured. Alternatively domain.com is not secured on firefox but it does reach the server block.

Any help would make my day!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @ulvar,

No need to have DigitalOcean configuration there. Additionally, can you please provide us with one of the configuration files so that we can see if anything is missed or needs to be added to it?

Additionally, what I’ll recommend is checking the Nginx’s Access and Error logs for further information as to why it’s not loading the website.

Regards,
KFSys

  • Hey @KFSys thanks for answering.

    Here is my configuration file of domain.com (/etc/nginx/sites-available/domain.com). I have replaced the comments with dots to make it easier to read.

    # comments
    # ...
    
    server {
            listen 80;
            listen [::]:80;
    
            # ...
    
            root /var/www/domain.com/html;
    
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.nginx-debian.html;
    
            server_name domain.com www.domain.com;
    
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    try_files $uri $uri/ =404;
            }
    
            # ...
    }
    

    I did remove the digitalocean file in the same directory, however nginx did not run after I restarted it. Once I copied default over to digitalocean file it worked again.

    My error.log and error.log.1 files where blank but my access.log and acces.log.1 files were filled with information.

    I tried to test if my domain2.com worked and since I did not own that domain name I changed so that domain2.com points to the droplets ip address which worked flawlessly and reached to the correct server block in chrome. Both configuration files looks identical.
    Can it be a problem in the DNS settings?

    I also noticed that my /etc/nginx/conf.d is empty. Maybe this is a problem?

    Thanks for the help,
    ulvar