rtmp_socket_dir
The `rtmp_socket_dir` directive specifies a directory for storing RTMP socket files used by the NGINX RTMP module.
Description
The rtmp_socket_dir directive defines the location of the Unix socket directory for RTMP connections. This is particularly useful in scenarios where socket communication is necessary, such as between different worker processes in a multi-threaded server setup. When defined, each worker process will create socket files in this specified directory, allowing concurrent RTMP stream handling and better performance through efficient inter-process communication.
The directory path should have appropriate permissions (typically 744) to allow the NGINX worker processes to read from and write to the socket files. If this directive is not set, NGINX might default to a temporary directory or may not perform optimally as worker processes may not be able to create or access the required socket files.
When configuring this directive, ensure that the path is valid and accessible, considering both the NGINX user permissions and any SELinux or AppArmor restrictions that might be in place. Proper path management can mitigate potential issues in handling RTMP streams, ensuring smooth live streaming and broadcasting.
Config Example
rtmp {
server {
listen 1935;
rtmp_socket_dir /var/run/nginx/rtmp;
application live {
live on;
}
}
}Ensure the specified directory exists and has appropriate permissions for the NGINX user.
If using SELinux or AppArmor, ensure that security policies allow socket file creation in the specified directory.
Setting this directive incorrectly may lead to failures in stream publishing or playing.