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.
phillxnet
(Philip Guyton)
April 22, 2023, 5:13pm
2
@aremiaskfa Hello again.
Re:
aremiaskfa:
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.
In the more recent versions of Rocsktor (testing) we use a systemd configuration override arrangement.
Take a look at the following pull request:
rockstor:testing
← phillxnet:2436_Rename_our_nginx_drop-in_override_systemd_file
opened 11:38AM - 07 Dec 22 UTC
To comply with upstream guidance we add "30-" to our recently added rockstor-ngi… nx-override.conf systemd override file.
We do not clean up our prior un-numbered variant as it was not included in any official released.
See: https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#Shipping_unit_file_drop-ins
Includes black formatting: missed in recent commits.
Fixes #2436
Where we updated this files name to 30-rockstor-nginx-override.conf
[Unit]
Description=The nginx HTTP and reverse proxy server - 30-rockstor-nginx-override.conf
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /opt/rockstor/etc/nginx/nginx.conf
# we first 'clean' the ExecStart as we are an override config
ExecStart=
ExecStart=/usr/sbin/nginx -c /opt/rockstor/etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=read-only
This file has been truncated. show original
As you see in that file we start nginx with the following directive:
[Unit]
Description=The nginx HTTP and reverse proxy server - 30-rockstor-nginx-override.conf
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /opt/rockstor/etc/nginx/nginx.conf
# we first 'clean' the ExecStart as we are an override config
ExecStart=
ExecStart=/usr/sbin/nginx -c /opt/rockstor/etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true
# added automatically, for details please see
# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
ProtectSystem=full
ProtectHome=read-only
PrivateDevices=true
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
phillxnet
(Philip Guyton)
April 23, 2023, 4:33pm
4
@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
EmptyNas
(Vincent )
December 8, 2024, 1:24pm
5
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