# Securing my RTMP Stream?

**URL:** <https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859>\
**Category:** Question\
**Created:** [September 3, 2022, 4:42pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859 "2022-09-03T16:42:17Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 3, 2022, 4:42pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/1 "2022-09-03T16:42:17Z")

</div>

My domain is secured with a cert, however, I am running an RTMP video streaming server in parallel to IIS 10 on port 8080. So to access this stream, the URL is my domain:8080/viewer.html. This URL however, is showing as unsecure on browsers.

Specifics: main web server is on port 80. nginx is on port 8080 and is the rtmp stream server.

Is there a simple way to add that port/server to the domain cert without having to get another separate cert?

When I hit the “+” in the certificate page, it won’t add it to the list.

 ![image](https://community.certifytheweb.com/uploads/default/original/1X/6a511ee8e5ef04d17220b8d21e1ed645a5f1911b.png)

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 4, 2022, 4:40am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/2 "2022-09-04T04:40:38Z")

</div>

Hi, so the domains list is only the list of domains that will be added to the certificate and it’s not anything to do with bindings (associating the cert with a specific port).

To use this certificate with your stream server you’ll need a deployment task (under Tasks) and you will need to decide how best to automate the deployment - either a script or exporting the file to a particular location. It will depend what your streaming software is and what format it expects the certificate file to be in. Some software (like IIS) can read certs from the computer certificate store, others need a particular file format.

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 4, 2022, 3:30pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/3 "2022-09-04T15:30:22Z")

</div>

I’m assuming I choose the “Deploy to nginx” option here.  
However, I am encountering this:

 ![image](https://community.certifytheweb.com/uploads/default/original/1X/e8b2914c2de49157086ada8c400e9fba5ca4fcbb.png)

I see under parameters that I can add C:\nginx to the path. It seemed to accept this. Now to find out if the stream is secure…

Page is still not secure. I wonder if there is a delay before this happens?

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 5, 2022, 2:58am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/4 "2022-09-05T02:58:54Z")

</div>

Thanks, we have a project under way to improve our documentation for deployment tasks but in this case:

- The path you set for each file should be the full destination path and filename of your choice e.g. for the fullchain.pem you might enter: `C\certs\basspig\fullchain.pem`
- You need to click the Play button next to your task to run it, this will create the output files from your latest certificate.
- The nginx, apache and Generic server deployment tasks **only write the files out in the required format** , they do not configure nginx etc for you, so you need to do that yourself. So you will need to investigate how to do that. For nginx this typically involves modifying your nginx.conf file server listen block. Future versions will have support for more automated deployment to nginx.

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 5, 2022, 3:27pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/5 "2022-09-05T15:27:23Z")

</div>

So if I understand correctly, I need to make a certs folder (does it have to be under C: root? or can it be under nginx\ ?) and then run the task to create the cert… but then I have to find out how to make nginx listen for the connection? Is that port 443/444 I need to set to listen?

Looks like the run command failed…  
 ![image](https://community.certifytheweb.com/uploads/default/original/1X/dfc63f47a895dc83e164800dc42f473e8761d172.png)

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 6, 2022, 12:17am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/6 "2022-09-06T00:17:59Z")

</div>

Nah, you’re skim reading my reply 🙂 you need to set the full filename to tell it where to write the files and what each should be called. You set a file name for each file you want to output, usually that would be the full chain file and the key file. You also need to create any folder you need e.g. if you want to use C:\nginx\certs then you need to create those folders.

Neither Certify nor nginx care which drive (or folder) you write the files to also long as they can both see that drive and have permission to write/read the files.

Then you need to configure nginx to point to those files in it’s configuration - so next time the renewal happens those files will have been automatically updated with the same name in the same location.

You will need to read up on nginx ssl: [Configuring HTTPS servers](http://nginx.org/en/docs/http/configuring_https_servers.html)

So for instance if you want your stream server on port 8080 to use a certificate (i.e. you don’t want to change the port) then you need to update the config to add the ssl stuff. So in your nginx.conf you perhaps have something a bit like:

```auto
server {
    listen 8080;
    server_name www.example.com;
}

```

and you need to add the ssl bits to turn that into https instead of http, then restart nginx:

```auto
server {
    listen 443 ssl;
    server_name www.example.com;
    ssl_certificate C:/nginx/certs/www.example.com.crt;
    ssl_certificate_key C:/nginx/certs/www.example.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ...
}

```

These settings are just an example.

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 6, 2022, 5:21pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/7 "2022-09-06T17:21:40Z")

</div>

It’s harder for me due to my advanced age and poor eyesight. Cataracts and double vision makes reading hard–can’t fix it with glasses.

So my grasp of it is in your example I need to replace example with my domain name, plus add all the other stuff?

I’ve got a section in there like this right now… do I add another section with the block above in your example right above it?

```auto
rtmp {
	server {
		listen 1935;
		chunk_size 4096;
		
		application live365 {

```

Thank you for the link to nginx HTTPS server config. I’ll study that. I may have questions though as I hash my way through this!

So I am about to write the nginx.conf file with the following:

```auto

server {
    listen 8080;
    server_name www.basspig.com;
}

server {
    listen 443 ssl;
    server_name www.basspig.com;
    ssl_certificate C:/nginx/certs/www.basspig.com.crt;
    ssl_certificate_key C:/nginx/certs/www.basspig.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ...
}

```

Is the syntax correct? Did I make a mistake anywhere here?

I made the changes, restarted nginx and tried running the task and got the following error:  
 ![image](https://community.certifytheweb.com/uploads/default/original/1X/b882d3288fd65ff8e0d1ed5f043ec18f87e18247.png)

UPDATE: I found out that path does not mean folder. It means the full path including the certificate and key filenames. Made those changes and Certify the Web completed with no errors. I don’t know how long it takes to deploy. My stream is still not secure.

![image](https://community.certifytheweb.com/uploads/default/original/1X/96c3cd3f12ecc76ec2d9999d1a8cf6bd4ea2e06e.png)

![image](https://community.certifytheweb.com/uploads/default/original/1X/f50c938741a63ece83ed6b2ea8655d43a438fb2d.png)

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 7, 2022, 12:02am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/8 "2022-09-07T00:02:06Z")

</div>

Several hours later after deploying the certificate with no apparent errors, but the live stream URL is still “not secure”.

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 7, 2022, 1:30am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/9 "2022-09-07T01:30:58Z")

</div>

Hi, after you make a change to nginx configuration or to the certificate you need to restart or reload nginx. You can do this using the `nginx reload` command or just restart your machine.

Looking at your example config above you have two server listen blocks, one for [www.basspig.com](http://www.basspig.com) on port 8080 (with no ssl) and one for [www.basspig.com](http://www.basspig.com) on port 443, with ssl (which looks correct, although I assume you don’t have the `...` in there as that just means “some other config you might have” and isn’t part of the config itself.

I also assume the port 443 site isn’t doing anything or is on a different machine to your normal website, because your normal website is using IIS and if they were on the same machine they would clash?

I don’t understand how your port 8080 site becomes related to the rtmp service. Is the port 8080 site just a web page or is it supposed to be the actual rtmp stream?

It might help if you post your entire nginx.confg contents (assuming there’s no passwords etc in there). Perhaps also describe how you have this setup in general - how many machines are there, if there is just one is it running both nginx and IIS? Could you just use IIS?

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 7, 2022, 2:40am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/10 "2022-09-07T02:40:53Z")

</div>

I’m running IIS 10 for the HTTP/S webserver and nginx per Doug Johnson’s setup for RTMP streaming. Therefore it has to be on port 8080 so not to clash with IIS on 80.

Here’s my nginx configuration:

```auto

#user nobody;
# multiple workers works !
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
	worker_connections 8192;
	# max value 32768, nginx recycling connections+registry optimization = 
	# this.value * 20 = max concurrent connections currently tested with one worker
	# C1000K should be possible depending there is enough ram/cpu power
	# multi_accept on;
}

server {
    listen 8080;
    server_name www.basspig.com;
}

server {
    listen 443 ssl;
    server_name www.basspig.com;
    ssl_certificate C:/nginx/certs/www.basspig.com.crt;
    ssl_certificate_key C:/nginx/certs/www.basspig.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ...
}

rtmp {
	server {
		listen 1935;
		chunk_size 4096;
		
		application live365 {
			
			live on;
			
			record off;
			# record all;
			# record_path /recordings;
			
			# push rtmp://c:/nginx/srv/hls/stream1;
			# push rtmp://a.rtmp.youtube.com/live2/0123-4567-89ab-cdef;
			
			hls on;
			hls_path /nginx/srv/hls/;
			hls_fragment 3;
			hls_playlist_length 60;
			
			# uncomment the line below to prevent people from playing using RTMP
			# deny play all;
		}
	}
}

http {

	include mime.types;
	
	server {
	
		listen 8080;
		
		location / {
			
			root /nginx/srv/;
			index index.html;
			
			add_header Cache-Control no-cache; # Disable cache
			
		}
	}
}

```

Should I be adding the certificate lines under the port 8080 basspig section of the config?

If I recall, I did shut down nginx and restart it to read the modified conf file.

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 7, 2022, 3:15am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/11 "2022-09-07T03:15:50Z")

</div>

Yes, to turn the port 8080 service into one that uses https you would change it to:

```auto
server {
    listen 8080 ssl;
    server_name www.basspig.com;
    ssl_certificate C:/nginx/certs/www.basspig.com.crt;
    ssl_certificate_key C:/nginx/certs/www.basspig.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
}

```

So the main thing is specifying `ssl` on the same line where you set the listening port, then also supplying the `ssl_certificate` and `ssl_certificate_key` files. There are lots of other options for things like `ssl_ciphers`, I have no idea if the example you are using for that is right or not though.

You would then access that service using https instead of http (to tell the browser to try an https connection instead of plain http).

I don’t think your port 443 listen block is going to do anything (or it may conflict with IIS) because IIS is already using port 443.

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 7, 2022, 3:58am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/12 "2022-09-07T03:58:20Z")

</div>

I changed that block of code to add the ssl and restarted nginx.

Should I just remove the whole block for the port 443 then?

It looks like it can’t provide a secure connection though:

 ![image](https://community.certifytheweb.com/uploads/default/original/1X/6ebae3fc1645cad4d6295cf1d2684bc65aa9363a.png)

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 7, 2022, 5:54pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/13 "2022-09-07T17:54:14Z")

</div>

I changed the block of code and verified that those two cert files exist in the folder referenced by Certify and tried https but still getting “this site can’t provide a secure connection”. ERR\_SSL\_PROTOCOL\_ERROR

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 8, 2022, 9:13am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/14 "2022-09-08T09:13:34Z")

</div>

> [@webprofusion](#):
>
> `HIGH:!aNULL:!MD5`

I just realised the example config you pasted above has two sections which setup a listen for port 8080 (one at the top of the file and one at the bottom). I’d expect you only need one of those, perhaps get rid of the top one and configure the bottom one?

I don’t think your port 443 block is doing anything (IIS will be serving the real https on the default port 443, so nginx can’t be doing it as well on the same port).

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 8, 2022, 5:15pm UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/15 "2022-09-08T17:15:37Z")

</div>

Is the reference to 8080 in this section of the conf file conflicting perhaps?  
Should I try commenting out the listen 8080 line?

```auto
http {

	include mime.types;
	
	server {
	
		listen 8080;
		
		location / {
			
			root /nginx/srv/;
			index index.html;

```

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 14, 2022, 1:27am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/16 "2022-09-14T01:27:40Z")

</div>

Some folks are reporting they can not view my stream because their browser says my site is not safe and they click “back to safety”. So it would behoove me to get this certificate problem solved and get the :8080 server under the cert.

---

<div class="post-metadata">

**Author:** ![webprofusion](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/webprofusion/32/4_2.png) [@webprofusion](https://community.certifytheweb.com/u/webprofusion)\
**Post date:** [September 14, 2022, 1:56am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/17 "2022-09-14T01:56:07Z")

</div>

Sorry, while I can provide some general guidance I’m afraid I can’t actually configure your system for you, you’re going to have to dig deep and solve it or hire someone to solve it for you.

As the system administrator you need to really take the lead on working this out - there’s nothing technically wrong with anything Certify The Web has done, you just haven’t yet configured your system to use the certificate you have.

I don’t know anything about your RTMP service or what it’s supposed to do so I can’t really solve this on your behalf. I’ve pointed out that your config has multiple listen blocks for port 8080 and suggested that you get rid of the top one but you’re going to have to do the work to figure out the rest, I’d suggest jumping on a support forum for the RTMP server as perhaps someone with more specific experience there could help. You have your certificate files, so that part is taken care of, you just need to figure out how to use them.

---

<div class="post-metadata">

**Author:** ![Basspig](https://community.certifytheweb.com/user_avatar/community.certifytheweb.com/basspig/32/393_2.png) [@Basspig](https://community.certifytheweb.com/u/Basspig)\
**Post date:** [September 14, 2022, 6:24am UTC](https://community.certifytheweb.com/t/securing-my-rtmp-stream/1859/18 "2022-09-14T06:24:44Z")

</div>

I have had to pull that code from the nginx conf file tonight because for some reason, nginx terminated and when I tried to restart it it would not start.

```auto
2022/09/14 01:08:57 [emerg] 3168#5036: "server" directive is not allowed here in C:\nginx/conf/nginx.conf:22
2022/09/14 01:08:58 [emerg] 9224#10564: "server" directive is not allowed here in C:\nginx/conf/nginx.conf:22

```

I pulled this code from the conf file:

```auto
rtmp {
    server {
            listen 8080 ssl;
            server_name www.basspig.com;
            ssl_certificate C:/nginx/certs/www.basspig.com.crt;
            ssl_certificate_key C:/nginx/certs/www.basspig.com.key;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_ciphers HIGH:!aNULL:!MD5;
}

```

and nginx started up again. I don’t know why nginx was alright with it for 3 days and tonight suddenly it’s not.

Obviously, I am in over my head on this stuff.
