CentOS5.10 installation and configuration Nginx1.0+PHP5.2.17+MySQL5.1.56+APC
1. Software list nginx-1.0.0.tar.gz (nginx main program) php-5.2.17.tar.bz2 (php main program) mysql-5.1.56.tar.gz (main program of mysql service) php-5.2.17-fpm-0.5.14.diff.gz (fastcgi patch) PDO_MYSQL-1.0.2.tgz (pdo_mysql extension. pdo is a unified interface for PHP to connect to the database, and the corresponding pdo driver is required to connect to the corresponding database) pcre-8.12.tar.gz (regular expression library, edit nginx support rewriting needs) mhash-0.9.9.9.tar.bz2 (hash encryption algorithm library, required by php) mcrypt-2.6.8.tar.gz (php encryption extension, libmcrypt library must be installed first) libmcrypt-2.5.8.tar.gz (encryption algorithm library, php extended mcrypt function is dependent on this library, this library must be installed before using mcrypt) libiconv-1.13.1.tar.gz (enhance the system’s ability to support character encoding conversion) memcache-2.2.6.tgz (memcache extension interface, if you want to use memcache function, you need to install memcached software separately) ImageMagick-6.6.9-6.tar.bz2 (ImageMagick image processing main program) imagick-3.0.1.tgz (php extension, image processing) go-pear.phar (php install pear support) 2. Preparation before installation 2.1. Check whether the rpm packages of apache, php and mysql have been installed rpm -qa | egrep ‘httpd|mysql|php’ If there is. The corresponding software of yum remove 2.2, yum install the following software yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file yum -y install libtool libtool-libs autoconf kernel-devel yum -y install libjpeg…
Solution to Nginx502 error
The NGINX 502 Bad Gateway error is due to a problem with FastCGI, which may cause the NGINX 502 error. I will 502 Bad The problems and troubleshooting methods related to Gateway errors are listed, starting with the FastCGI configuration: 1. Whether the FastCGI process has been started 2. Is the number of FastCGI worker processes not enough? Run netstat -anpo | grep “php-cgi” | wc -l Judging whether it is close to the FastCGI process, close to the value set in the configuration file, DNF automatically indicates that the number of worker processes is too small 3. The execution time of FastCGI is too long According to the actual situation, increase the following parameter values fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; 4. FastCGI Buffer is not enough nginx is the same as apache, CF perspective has a front-end buffer limit, you can adjust the buffer parameters fastcgi_buffer_size 32k; fastcgi_buffers 8 32k; 5. Proxy Buffer is not enough If you use Proxying, adjust proxy_buffer_size 16k; proxy_buffers 4 16k; 6. https forwarding configuration error The correct configuration method server_name; location /myproj/repos { set $fixed_destination $http_destination; if ( $http_destination ~* ^https(.*)$ ) { set $fixed_destination http$1; } proxy_set_header Host $host; proxy_set_header X-Real-IP…
Windows system installation and configuration Nginx+PHP server environment
This article is my steps for Nginx and PHP5.2 in Windows XP installation. PHP5 Configuration Installing PHP5, how to connect mysql, etc. are not the focus of this article. Assume that php5 has been installed in the c:php5 directory. This article focuses on the basic installation of Nginx and its connection to PHP. Here we only mention one item of setting php.ini: ; CGI settings ; cgi.fix_pathinfo = 1 ; CGI settings cgi.fix_pathinfo=1 Modify php.ini, set cgi.fix_pathinfo = 1, this is very important, PHP will fix SCRIPT_FILENAME is the real file address, otherwise PHP will not be able to find the php file that needs to be processed. Configuring PHP FastCGI Nginx needs to cooperate with FastCGI Server to process requests. Let me talk about how FastCGIServer works first, there are two ways to run PHP FastCGI Server: One is to use PHP’s built-in FastCGI manager: C:/php5/php-cgi.exe -b 127.0.0.1:9000 -c C:/php5/php.ini C:/php5/php-cgi.exe -b 127.0.0.1:9000 -c C:/php5/php.ini Another way is to use third-party tools: Such as PHP-FPM, cgi-fcgi, etc. Obviously! It’s a pain in the ass to use these tools in Windows, you probably need Cygwin and stuff like that, some people do, although I think it’s asking for trouble. Let’s…
How to optimize performance of Nginx server in high concurrency
If you use google-perftools developed by googler to optimize the memory management of Nginx and MySQL, the performance will be improved to a certain extent. Especially for servers under high concurrency, the effect is more obvious! Note: This tutorial is for Linux only. The following is an introduction to the installation of google-perftools, and configuration of Nginx and MySQL to support google-perftools. First, how to optimize Nginx: 1, first download and install google-perftools: Note, if it is a 64-bit system: Then you need to do: 1) Install libunwind first or 2) Add –enable-frame-pointers when configure. So first talk about how to install libunwind: wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz tar zxvf libunwind-0.99.tar.gz cd libunwind-0.99/ CFLAGS=-fPIC ./configure –prefix=/usr make CFLAGS=-fPIC make CFLAGS=-fPIC install Go here and install libunwind to complete. If you use the method of adding –enable-frame-pointers, don’t worry about it, let’s go down. Download and install google-perftools: wget http://google-perftools.googlecode.com/files/google-perftools-1.7.tar.gz tar xzvf google-perftools-1.7.tar.gz cd google-perftools-1.7 Then start configuration: ./configure –prefix=/usr –enable-frame-pointers Pay attention to this step here, if it is a 32-bit system, you can not add –enable-frame-pointers, if it is a 64-bit system, and you have not installed libunwind before, then you must add this: –enable-frame-pointers Compile and install: make make install The…
How does the Nginx server count the number of users watching the channel online during RTMP live broadcast
Your Nginx already has RTMP For the live broadcast function, if you want to count the number of users currently watching a live channel, you can add with-http_xslt_module module. The specific steps are as follows: 1. Check the original parameters /usr/local/nginx/sbin/nginx -V In the output, you can get the parameters that were included in the original compilation, for example, the author got: –user=nginx –group=nginx –with-http_stub_status_module –with-http_gzip_static_module –with-http_ssl_module –with-http_flv_module –with-http_perl_module –with-mail These parameters are still available when we install new modules. 2. Download nginx-rtmp-module Installation package nginx-rtmp-module-master.zip, latest download address: https://github.com/arut/nginx-rtmp-module. After downloading, unzip it to get nginx-rtmp-module-master Table of contents. 3. Download nginx-1.3.8.tar.gz package Available at http://nginx.org/download/ Find the version you need. After downloading, decompress to get the nginx-1.3.8 directory. 4. Close nginx ps – ef | grep nginx Find the master process in the process list, which is the main process number of nginx. kill -TERM main process number nginx is turned off. 5. Install other dependent packages yum install pcre-devel yum install openssl-devel yum install perl-devel perl-ExtUtils-Embed yum install gcc yum install libxml2 libxml2-devel libxslt libxslt-devel 6. Compile with-http_xslt_module module Add the following parameters after the series of parameters obtained in step 1: –with-http_xslt_module –add-module=/home/defonds/nginx-rtmp-module-master in /home/defonds/nginx-rtmp-module-master is…
Steps to install ngnix server in CENTOS6.5 64-bit system
Sorted out from the Internet: cent os6.5 64-bit method of installing ngnix. Environment preparation: yum -y install gcc gcc-c++ autoconf automake make yum -y install zlib zlib-devel openssl openssl –devel pcre pcre-devel Download nginx wget http://nginx.org/download/nginx-1.0.2.tar.gz Unzip tar ?xzvf nginx-1.0.2.tar.gz cd nginx-1.0.2 ./configure configure supports the following options: –prefix= – Nginx installation path. If not specified, defaults to /usr/local/nginx. –sbin-path= – Nginx executable file installation path. It can only be specified during installation, if not specified, the default is /sbin/nginx. –conf-path= – The path to the default nginx.conf when no -c option is given. If not specified, defaults to /conf/nginx.conf. –pid-path= – The path of the default nginx.pid when no pid directive is specified in nginx.conf. If not specified, defaults to /logs/nginx.pid. –lock-path= – Path to nginx.lock file. –error-log-path= – The path to the default error log if no error_log directive is specified in nginx.conf. If not specified, defaults to /logs/error.log. –http-log-path= – The default access log path when no access_log directive is specified in nginx.conf. If not specified, defaults to /logs/access.log. –user= – In the case that no user directive is specified in nginx.conf, the default user used by nginx. If not specified, defaults to nobody. –group= – The…
Detailed explanation of status command in Nginx server
First, you need to add the –with-http_stub_status_module parameter when compiling nginx, that is, enable this module. This module is able to get the working status of Nginx since the last time it was started. Second, add configuration to the nginx configuration file. 1. Direct domain name access server { listen 80; server_name www.server110.com; location / { stub_status on; access_log off; #allow SOME.IP.ADD.RESS; #deny all; } } 2. Add to a directory location /nginx_status { stub_status on; access_log off; #allow SOME.IP.ADD.RESS; #deny all; } Both methods can limit the access of other IP addresses only by setting the allowed IP. I set up direct domain name access. By visiting http://www.server110.com to understand the status of nginx, some text similar to the following will appear. Active connections: 75 server accepts handled requests 1702064 1702064 2683321 Reading: 1 Writing: 4 Waiting: 70 active connections ? The number of active connections currently being processed by Nginx (the number of active connections initiated to the backend). serveraccepts handled requests — a total of 1702064 connections were processed, and 1702064 were successfully created Handshake times (to prove that there is no failure in the middle), a total of 2683321 requests were processed (an average of 2683321/1702064…
Windows7 system installation and configuration Nginx+PHP5 server environment
Nginx is a lightweight high-performance Http WebServer written in an event-driven manner, so compared to Apache In terms of Nginx, it is more stable, has better performance, and is simple to configure and consumes less resources. Below is my Windows 7 installation of Nginx and PHP5.3 A step of. Install PHP5 First, download the latest from http://www.php.net/downloads.php PHP 5.3 Windows version, decompress to C:\php5, rename php.ini-recommended in the compressed package to php.ini, and then open and modify several options: error_reporting = E_ALL display_errors = On extension_dir = “C:\php5\ext” ; Dynamic extension, you can remove the comment in front of extension as needed; ; If loading PDO, MySQL extension=php_pdo.dll extension=php_pdo_mysql.dll ; CGI Settings cgi.fix_pathinfo= Pay attention to dependencies when loading extensions in PHP, for example, php_exif.dll needs php_mbstring.dll, you must put php_mbstring.dll must be placed in front of php_exif.dll to load successfully. Some extensions rely on additional dll files, such as PHP 5.0+, php_mysqli.dll depends on libmysql.dll, and php_oci8.dll, you need to install Oracle 8 client. If you are not familiar with these dependencies, you can refer to the install.txt file in the installation package. The search order of dependent files: first is the directory where php.exe is located. If it…
XP system installation and configuration NginxPHP server environment
This is my first attempt, so please help me. Thanks. nginx Nginx (“engine x”) is a high-performance HTTP and reverse proxy server and a IMAP/POP3/SMTP proxy server. Nginx is the second most visited Rambler.ru in Russia by Igor Sysoev developed by the site, and it has been running at the site for over four years. Igor releases the source code under a BSD-like license. In the four years since Nginx was released, Nginx Already known for its stability, rich feature set, sample configuration files and low consumption of system resources. At present, Nginx has been deployed on major domestic portal websites, such as Sina, NetEase, Tencent, etc.; several important domestic video sharing websites have also deployed Nginx, such as Six Rooms, Cool 6, etc. Newly discovered Nginx Technology is becoming more and more popular in China, and more and more websites have begun to deploy Nginx. PHP PHP is the abbreviation of Hypertext Preprocessor in English. PHP is a type of HTML Embedded language is a scripting language that is executed on the server side and embedded in HTML documents. The language style is similar to C language and is widely used. Another meaning of PHP is: Standard symbol for…
Apache server uses mod_rpaf to obtain front-end NginxIP
Since the emergence of Nginx, we all like to let Nginx run ahead to process static files, and then filter dynamic requests to apache. So there is a problem, the IP obtained by the application running on the rear apache is the IP of the server where Nginx is located, or the local machine 127.0.0.1 . The most obvious is to look at the apache access log. You will see that coming and going are all intranet IPs. If your application has security rules for IP discrimination such as “single IP cannot log in repeatedly”, “single IP registrations are separated by n minutes”… and so on. So troublesome… But fortunately, you can modify the parameters of nginx proxy to make the backend application obtain the request message sent by Nginx to obtain the IP of the external network. proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; But the problem solved by this is only on the application, the ip obtained on the apache log is still local. In particular, ill-conceived applications such as Tattertools (a blogging program) make mistakes. The access log in the background shows that the number of visitors is 1, and the ip is from 127.0.0.1…