How to disable port 80 and redirection to https?

Hello there,

I am trying to set up reverse proxies via nginx-proxy-manager, and I am having troubles setting port 80 for it, because Rockstor’s nginx is using it.

Even though I have changed port 80 → 89 in nginx.conf/.default and reloaded nginx, it still uses port 80.
Even if I kill all nginx services and let the supervisor to bring it back, it will still use port 80.

Many users had solutions in pre-SUSE era, but they don’t work anymore.

Thanks.

@aremiaskfa Hello again.
Re:

In the more recent versions of Rocsktor (testing) we use a systemd configuration override arrangement.

Take a look at the following pull request:

Where we updated this files name to 30-rockstor-nginx-override.conf

As you see in that file we start nginx with the following directive:

So changing the /opt/rockstor/etc/nginx/nginx.conf file on your system may do the trick for you.

Hope that helps.

3 Likes

Nice. I will wait for the update. Thanks

@aremiaskfa Hello again.
Re:

The referenced files/mechnisms are actually all already in place within our testing channel. So if you are already running that then you can steam-in with altering the referenced files and let us know if this worked for your.

Hope that helps.

2 Likes

Hi,
with follwoing setting i got the nginx-proxy-manger to work:

nginx-proxy-manager:

nginx.config: (found in /opt/rockstor/etc/nginx/nginx.conf)

daemon off;
worker_processes  2;

events {
        worker_connections  1024;
        use epoll;
}

http {
        include         /opt/rockstor/etc/nginx/mime.types;
        default_type    application/octet-stream;

        log_format main
                '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '"$gzip_ratio"';

        client_header_timeout   10m;
        client_body_timeout             10m;
        send_timeout                    10m;

        connection_pool_size            256;
        client_header_buffer_size       1k;
        large_client_header_buffers     4 8k;
        request_pool_size                       4k;

        gzip on;
        gzip_min_length 1100;
        gzip_buffers    4 8k;
        gzip_types      text/plain;

        output_buffers  1 32k;
        postpone_output 1460;

        sendfile        on;
        tcp_nopush      on;
        tcp_nodelay     on;

        keepalive_timeout       75 20;
        ignore_invalid_headers  on;
        index index.html;

        server {
                listen 81;
                server_name 192.168.XXX.XX;

                location / {
                        proxy_pass http://127.0.0.1:8000/;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Real-IP $remote_addr;
                }
        }

        server {
                listen 192.168.XXX.XXX:444 ssl default_server;
                server_name "~^(?<myhost>.+)$";
                ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
                ssl_certificate /opt/rockstor/certs/rockstor.cert;
                ssl_certificate_key /opt/rockstor/certs/rockstor.key;

                location /site_media  {
                        root /media/; # Notice this is the /media folder that we create above
                }
                location ~* ^.+\.(zip|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mov) {
                        access_log   off;
                        expires      30d;
                }
                location /static  {
                        root /opt/rockstor/;
                }
                location /logs {
                        root /opt/rockstor/src/rockstor/;
                }
                location / {
                        proxy_pass_header Server;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Forwarded-Proto https;
                        proxy_redirect off;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Scheme $scheme;
                        proxy_connect_timeout 75;
                        proxy_read_timeout 120;
                        proxy_pass http://127.0.0.1:8000/;
                }
                location /socket.io {
                        proxy_pass http://127.0.0.1:8001/socket.io;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Forwarded-Proto $scheme;
                        proxy_set_header X-Forwarded-Host $http_host;
                        proxy_redirect off;
                        proxy_http_version 1.1;
                        proxy_buffering off;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "Upgrade";
                }
                location /shell/ {
                        valid_referers server_names;
                        if ($invalid_referer) { return 404; }
                        proxy_pass http://127.0.0.1:4200;
                        proxy_redirect off;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "upgrade";
                }
        }
}

So i changed the ssl port 443 into 444. Can also be done with the Web UI.
Added the server entry for port 81.

Without this the proxy-manager was not working for me.

2 Likes