to get a basic mqtt
This commit is contained in:
@@ -21,14 +21,19 @@ log_facility 5
|
|||||||
|
|
||||||
## Nginx router
|
## 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)
|
conf file [here](nginx.conf)
|
||||||
|
|
||||||
|
```
|
||||||
check firewal and selinux in case of problem
|
check firewal and selinux in case of problem
|
||||||
sudo firewall-cmd --permanent --zone=public --add-port=8883/tcp
|
sudo firewall-cmd --permanent --zone=public --add-port=8883/tcp
|
||||||
|
sudo firewall-cmd --reload
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
49
nginx-1883.conf
Normal file
49
nginx-1883.conf
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user