In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to build a window + nginx-rtmp + php-cgi server. The content of the article is of high quality. Therefore, Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.
1. The application package that needs to be prepared first.
nginx : nginx-rtmp-win32 or nginx/Windows-1.0.4 (no rtmp module)
php: php-5.2.16-nts-Win32-VC6-x86.zip (php under nginx runs in FastCGI mode, so we download the php package that is not thread safe, that is, nts)
RunHiddenConsole: RunHiddenConsole.zip (for cmd non-blocking running processes)
2. Installation and configuration.
1) PHP installation and configuration.
Unzip the downloaded php package directly to the D disk wnmp directory (D:wnmp), where the decompressed folder is renamed php5. Go to the folder and change the php.ini-recommended file to php.ini and open it with Editplus or Notepad++. find
Extended table of contents (remove comments)
;extension_dir = "ext"
mysql extension (remove comments)
;extension=php_mysql.dll ;extension=php_mysqli.dll
After specifying the ext path of php, just remove the corresponding ";" in front of the required extension package. Open php_mysql.dll and php_mysqli.dll here to make PHP support mysql. Of course, don't forget that the important step is to copy the libmysql.dll file in the php5 directory to the C:Windows directory, or specify the path in the system variable, of course, I chose the more convenient method ^_^here.
At this point php is ready to support mysql.
Next, let's configure PHP so that PHP can be combined with nginx. Find (remove comments)
;cgi.fix_pathinfo=1
This step is very important, here is the CGI settings for php.
2) Installation and configuration of nginx.
Extract the downloaded nginx-1.0.4 package to the wnmp directory of disk D and rename it nginx. Next, let's configure nginx to work with php. Go to the conf directory of nginx and open the nginx configuration file nginx.conf.
worker_processes 1; error_log logs/error.log debug; events { worker_connections 1024; } rtmp { server { listen 1936; application live { live on; pull rtmp://live.hkstv.hk.lxdns.com/live/hks live=1 name=1; } } } http { access_log logs/access.http.log; server_tokens off; default_type application/octet-stream; client_max_body_size 10G; sendfile on;
current directory create other.conf
server { listen 7777; server_name live_stream; root www; index index.php; location / { if (!- e $request_filename) { rewrite ^(.*)$ /index.php? s=/$1 last; # rewrite mode #rewrite ^(.*)$ /index.php/$1 last; # pathinfo mode } } location ~ \.php$ { fastcgi_hide_header X-Powered-By; fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\. php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } }
Save the configuration file and you're done.
The nginx+php environment is initially configured, so let's run and see. We can input commands.
X:\wnp\php\php-cgi.exe -b 127.0.0.1:900 -c X:\wnp\php\php.ini
Double-click nginx.exe
Done!!!
3. Batch script control switch server
1.start.cmd
@echo off REM Invalid under Windows REM set PHP_FCGI_CHILDREN=5 REM *** number of requests processed per process, or set to Windows environment variable set PHP_FCGI_MAX_REQUESTS=1000 echo Starting PHP FastCGI... RunHiddenConsole D:/wnmp/php5/php-cgi.exe -b 127.0.0.1:9000 -c D:/wnmp/php5/php.ini echo Starting nginx... RunHiddenConsole D:/wnmp/nginx/nginx.exe -p D:/wnmp/nginx
2.end.cmd
@echo off echo Stopping nginx... taskkill /F /IM nginx.exe > nul echo Stopping PHP FastCGI... taskkill /F /IM php-cgi.exe > nul exit
4. fill the pit
php file failed to receive arguments,$_GET,$_POST,$_REQUEST, empty
Solution: In the other.conf file,"include fast_params" nginx official website example
location ~ \.php$ { fastcgi_hide_header X-Powered-By; fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\. php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; }
5. references
1.Configure nginx+php environment under windows
About how to carry out window + nginx-rtmp + php-cgi server build to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.