diff --git a/README.md b/README.md index 3b3c540..23c74d9 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,19 @@ log_facility 5 ## Nginx router -Install nginx +In case mosquitto is not facing internet directly, a proxy server may needed. Caddy do not work, only nginx. + +To install nginx ``` -sudo dnf install nginx +sudo dnf install nginx nginx-mod-stream ``` conf file [here](nginx.conf) +``` check firewal and selinux in case of problem sudo firewall-cmd --permanent --zone=public --add-port=8883/tcp +sudo firewall-cmd --reload +``` diff --git a/nginx-1883.conf b/nginx-1883.conf new file mode 100644 index 0000000..8b4b3fd --- /dev/null +++ b/nginx-1883.conf @@ -0,0 +1,49 @@ +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; + + include /etc/nginx/conf.d/*.conf; + +server { + server_name mqtt.33co.de; + listen 8133; + return 301 http://www.33co.de$request_uri; +} + + +} + +stream { + upstream mosquitto { + server XXX.XXX.XXX.XXX:1883; + } + + server { + listen 1883; + proxy_pass mosquitto; + } +}