server { server_name example.com; listen 80; listen 443; # force HTTPS protocol include /srv/example.com/nginx/conf/force_https_protocol.conf; # set $openfire_port based in the protocol (http/https) set $penfire_port 9090; if ($server_port = 443) { set $penfire_port 9091; } # proxy for openfire server location / { proxy_pass https://jabber.example.com:$openfire_port; } # logging access_log /srv/jabber.pastoraldacrianca.org.br/nginx/log/access.log; error_log /srv/jabber.pastoraldacrianca.org.br/nginx/log/error.log; }