lafleche
By:
lafleche

This site can’t be reached refused to connect.

October 15, 2017 246 views
Nginx Ubuntu 16.04

I'm trying to get nginx to work on my server. I was trying to get it to work with a more complex config, but I gave up and reinstalled it. I'm working with a really simple config here:

*File: /etc/nginx/nginx.conf *

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

*File: /etc/nginx/sites-enabled/default *

server {
listen 80 defaultserver;
listen [::]:80 default
server;

    root /var/www/html;

    index index.html index.nginx-debian.html;

    server_name [mydomain] [www.mydomain];

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }

}

I followed the instructions on: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04

I still get a This site can’t be reached [my IP] refused to connect.

1 Answer

Have you tried server_name 127.0.0.1; where 127.0.0.1 works for localhost but you can change it for the real server's IP?

Have another answer? Share your knowledge.