0

So my problem is the following. I am using CentOS 7.8 and I installed nginx, php, mariadb and certbot. After successfully generating the SSL certificate certbot automatically overwrote the NGINX config file (well I did agree to that and it usually works). I looked at it and nothing seems to be wrong with it. What's the problem? Firewall has ports 80 and 443 open... There are no other virtual hosts setup... My partly automatically generated and partly automatically appended nginx config:

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

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

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }
  server {
    server_name www.example.org example.org; # managed by Certbot
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }


    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.org/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


}

    server {
    if ($host = example.org) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen       80 ;
        listen       [::]:80 ;
    server_name example.org;
    return 404; # managed by Certbot


}}

Munchkin
  • 133
  • 1
  • 1
  • 11
  • A timeout usually points toward a firewall issue. Just because you disabled one that doesn't ensure that there isn't another one blocking traffic between you and your server. – Gerald Schneider Oct 27 '20 at 14:00
  • @GeraldSchneider The software firewall is disabled at the moment and the hardware one has ports 80 and 443 open... – Munchkin Oct 27 '20 at 14:06
  • nginx configuration doesn't cause timeouts, so the problem is somewhere else. – Tero Kilkanen Oct 27 '20 at 15:57
  • nginx -T && iptbales -S && netstat -tulpn && cat /var/log/syslog --- some commands to start with. you may poste the output here. – Berndinox Oct 27 '20 at 19:06
  • I reinstalled the server and everything worked fine, but this time I used Apache. Not sure what the issue was, maybe the disabled and marked `firewalld` ? – Munchkin Oct 28 '20 at 14:26

1 Answers1

0

I had same issue with one of my server. Client was using hardware firewall and complex NAT. Please try to do below things.

  1. Try to disable firewall(software/hardware)
  2. Check Server IP configuration
  3. Check NAT of server