Operation and Maintenance
Linux Operation and Maintenance
Use nginx and nginx-rtmp-module to build a streaming media serverUse nginx and nginx-rtmp-module to build a streaming media server
I encountered a very embarrassing problem when using nginx and nginx-rtmp-module to build a streaming media server. That was the approach I initially took when adding the nginx-rtmp-module module to nginx. First uninstall the original nginx, then download the source code of nginx and nginx-rtmp-module, recompile and install it. After reinstalling, I tested the streaming media server and it was normal, but then the problem came because I had some WEB The projects were deployed in the LUMP environment that was built before. Now that nginx has been reinstalled, these projects need to be redeployed. So, I started to redeploy these WEB projects, but the result made me cry in the toilet because the directory of nginx The structure has changed a lot, so I can't configure the original WEB project. After that, I struggled and wandered for a long time. I searched for many solutions on the Internet, but most of these solutions focused on how to compile and install nginx and The push-pull flow test did not involve my problem. Later, when I was browsing the post, I saw someone saying that replacing the original nginx shared library with the nginx executable file compiled by myself could solve the problem, so I immediately tried it. It turned out that it really works! Now nginx can run streaming media services and deploy WEB projects at the same time, and have the best of both worlds!
Let me briefly introduce my operation process, hoping to help others who encounter the same problem. If you have a problem, please bring some help (my configuration environment: Ubuntu Server 16.04 + nginx1.10.0 + nginx-rtmp-module-master).
1. First install nginx using apt-get. Currently using The version number of nginx installed in this way is 1.10.0
1 sudo apt-get update2 sudo apt-get install nginx
2. Go to your favorite directory and create a directory with your favorite name to store nginx and nginx-rtmp -Module source code, for example: I created the nginx directory under the root directory/softwares (softwares was also created by myself), and then I will download nginx and nginx-rtmp-module to the nginx directory.
1 cd softwares/2 sudo mkdir nginx
3. Enter the nginx directory.
1 cd nginx/
4. Download the nginx source code. Note: The downloaded source code version needs to be consistent with the version of nginx installed in step 1. , to avoid unnecessary problems. There are many ways to obtain nginx source code. Here are two methods recommended.
Method a: Execute apt-get source nginx command in the terminal to directly obtain the source code of the corresponding version.
1 sudo apt-get source nginx
This method will automatically decompress after downloading. The nginx-1.10.0 directory is the nginx source code directory.
Method b: Find the corresponding version on the official website of nginx and then Download.
1 sudo wget nginx.org/download/nginx-1.10.0.tar.gz
After downloading in this way, you need to manually decompress it yourself. Decoding command:
1 sudo tar zxvf nginx-1.10.0.tar.gz
5. Download nginx-rtmp-module Source code.
1 sudo wget github.com/arut/nginx-rtmp-module/archive/master.zip
Because nginx-rtmp-module is open source on GitHub, you can also get it directly from GitHub. GitHub address:
6. Unzip nginx- Compressed package of rtmp-module source code.
1 sudo unzip master.zip
7. Enter the nginx source code directory.
1 cd nginx-1.10.0/
8. View the current nginx configuration information, And save the current configuration information completely to one place. Later, when compiling the nginx source code, you need to configure it based on the current configuration information.
1 nginx -V
Note that the V in the command line is capitalized. , only the version number of nginx can be seen in lowercase. My current nginx configuration information is as follows:
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads
9. Configure nginx source code compilation information and add nginx-rtmp-module to nginx .
1 sudo ./configure --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=../nginx-rtmp-module-master
Note that this line of command actually consists of: sudo ./configure
10. After the configuration is completed, execute the make command to start compiling the nginx source code. After the compilation is completed, the nginx executable file will be generated in the objs directory of the nginx source code directory.
1 sudo make
11. Will the generated nginx Copy the executable file to the /usr/sbin directory and replace the original nginx shared library file. Note: There is an nginx shared library file in the /usr/sbin directory. We use the compiled nginx executable file to replace it.
1 sudo nginx /usr/sbin
12. Restart nginx.
1 sudo service nginx restart
13. Check the nginx configuration information again.
1 nginx -V
You can see that the nginx-rtmp-module module has been added to nginx.
1 --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=../nginx-rtmp-module-master
I tried pushing and pulling the stream, and the function was normal. I ran the original WEB project again, and it was normal!
Finally, I will explain why we need to install nginx through apt-get first, and then Compile and replace. The reason is to facilitate the deployment of WEB projects in the LUMP environment. If you do not install nginx through apt-get first, but directly download the source code to compile and install, the nginx configuration directory will be incomplete and it will be difficult to deploy WEB Project (deployment may also be achieved through certain operations, but you still need to spend time studying nginx for the specific operation). If you do not build a streaming media service, I recommend installing nginx through apt-get. The steps are simple and worry-free. !
The above is the detailed content of Use nginx and nginx-rtmp-module to build a streaming media server. For more information, please follow other related articles on the PHP Chinese website!
Linux: How to Enter Recovery Mode (and Maintenance)Apr 18, 2025 am 12:05 AMThe steps to enter Linux recovery mode are: 1. Restart the system and press the specific key to enter the GRUB menu; 2. Select the option with (recoverymode); 3. Select the operation in the recovery mode menu, such as fsck or root. Recovery mode allows you to start the system in single-user mode, perform file system checks and repairs, edit configuration files, and other operations to help solve system problems.
Linux's Essential Components: Explained for BeginnersApr 17, 2025 am 12:08 AMThe core components of Linux include the kernel, file system, shell and common tools. 1. The kernel manages hardware resources and provides basic services. 2. The file system organizes and stores data. 3. Shell is the interface for users to interact with the system. 4. Common tools help complete daily tasks.
Linux: A Look at Its Fundamental StructureApr 16, 2025 am 12:01 AMThe basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.
Linux Operations: System Administration and MaintenanceApr 15, 2025 am 12:10 AMThe key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.
Understanding Linux's Maintenance Mode: The EssentialsApr 14, 2025 am 12:04 AMLinux maintenance mode is entered by adding init=/bin/bash or single parameters at startup. 1. Enter maintenance mode: Edit the GRUB menu and add startup parameters. 2. Remount the file system to read and write mode: mount-oremount,rw/. 3. Repair the file system: Use the fsck command, such as fsck/dev/sda1. 4. Back up the data and operate with caution to avoid data loss.
How Debian improves Hadoop data processing speedApr 13, 2025 am 11:54 AMThis article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file
How to learn Debian syslogApr 13, 2025 am 11:51 AMThis guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud
How to choose Hadoop version in DebianApr 13, 2025 am 11:48 AMWhen choosing a Hadoop version suitable for Debian system, the following key factors need to be considered: 1. Stability and long-term support: For users who pursue stability and security, it is recommended to choose a Debian stable version, such as Debian11 (Bullseye). This version has been fully tested and has a support cycle of up to five years, which can ensure the stable operation of the system. 2. Package update speed: If you need to use the latest Hadoop features and features, you can consider Debian's unstable version (Sid). However, it should be noted that unstable versions may have compatibility issues and stability risks. 3. Community support and resources: Debian has huge community support, which can provide rich documentation and


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft





