0

So I have a basic Nginx configuration that redirects any request to my site to www and HTTPS:

server {
    listen 80;
    listen [::]:80;
    server_name www.goodjobs.ro goodjobs.ro;
    return 301 https://www.goodjobs.ro$request_uri;
}

server {
    listen 443 ssl;
    ssl_certificate hidden/path;
    ssl_certificate_key hidden/path;
    server_name goodjobs.ro;
    return 301 https://www.goodjobs.ro$request_uri;
}


server {
        server_name goodjobs.ro www.goodjobs.ro;
        listen 93.188.166.124 http2;
        listen 93.188.166.124:443 ssl http2;
        root /home/goodjobs/public_html;
        index index.php index.htm index.html;
        location ^~ /.well-known/ {
                try_files $uri /;
        }
        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
        ssl_certificate hidden/path;
        ssl_certificate_key hidden/path;
}

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

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;
 
        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
 
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
 
        ##
        # SSL Settings
        ##
 
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
 
        ##
        # Logging Settings
        ##
 
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
 
        ##
        # Gzip Settings
        ##
 
        gzip on;
 
        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
 
        ##
        # Virtual Host Configs
        ##
 
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
        server_names_hash_bucket_size 64;
}

On chrome, it works perfectly, but on safari, it doesn't

Behavior on Safari:

If I type the URL normally or with http://, the website doesn't work. But if I type it with https://, it loads

My theory is that safari doesn't get the http redirect (first server block)

And chrome and Mozilla get it

5
  • Don't redact the domain. If you include the domain we can easily check how the server behaves.
    – vidarlo
    Jan 12, 2023 at 12:40
  • Done, now the domain is visible Jan 12, 2023 at 13:01
  • I don't know nginx very well, but the problem is that your webserver is talking TLS on port 80. It should only talk TLS on port 443, and plain HTTP on port 80. Why? Someone who knows nginx should answer... :)
    – vidarlo
    Jan 15, 2023 at 10:20
  • Your site works fine on Safari for me. Jan 16, 2023 at 7:03
  • 1
    I fixed it. the problem was that i listened to port 80 and had http2 enabled (listen 80 http2;) Jan 17, 2023 at 11:23

0

You must log in to answer this question.

Browse other questions tagged .