In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article gives you a brief introduction of the process related to Nginx+PHP configuration, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
There are many technical application skills in Nginx+PHP configuration, and network administrators need to pay attention to relevant knowledge when learning. Create a php-fpm configuration file (php-fpm is a FastCGI management patch for PHP to smoothly change the php.ini configuration without restarting php-cgi) create an php-fpm.conf file in the / usr/local/webserver/php/etc/ directory:
Rm-f / usr/local/php/etc/php-fpm.conf my default does not have this vi / usr/local/php/etc/php-fpm.conf
Enter the following (if you install Nginx + PHP for program debugging, change the following 0 to 1 to display the PHP error message, otherwise Nginx will report a blank error page with a status of 500):
See the following in the configuration
Unix user of processes www Unix group of processes www
Mine is nobody, so change it to nobody.
two hundred
Start the Nginx+PHP configuration-cgi process, listen on port 9000 of 127.0.0.1, and the number of processes is 200 (if the server memory is less than 3GB, you can only open the max_children in the 64 processes / reference configuration file and temporarily change it to the 32 internal test machine). The user is nobody:
Ulimit-SHn 51200 # / usr/local/php/sbin/php-fpm start Starting php_fpm done [root@test php-5.2.6] # ps fax | grep fpm 17489 pts/2 S+ 0:00\ _ grep fpm 17453? Ss 0:00 / usr/local/php/bin/php-cgi-fpm 17454? S 0:00\ _ / usr/local/php/bin/php-cgi-fpm 17455? S 0:00\ _ / usr/local/php/bin/php-cgi-fpm 17456? S 0:00\ _ / usr/local/php/bin/php-cgi-- fpm [root@test php-5.2.6] # ps fax | grep fpm | wc-l
Note: / usr/local/php/sbin/php-fpm has other parameters, including: start | stop | quit | restart | reload | logrotate, do not restart php-cgi after modifying php.ini, and reload configuration file using reload
All relative paths in this config are relative to php's install prefix Pid file / usr/local/php/logs/php-fpm.pid Error log file / usr/local/php/logs/php-fpm.log Log level notice When this amount of php processes exited with SIGSEGV or SIGBUS... 10... In a less than this interval of time, a graceful restart will be initiated. Useful to work around accidental curruptions in accelerator's shared memory. 1m Time limit on waiting child's reaction on signals from master 5s Set to 'no' to debug fpm yes Name of pool. Used in logs and stats. Default Address to accept fastcgi requests on. Valid syntax is' ip.ad.re.ss:port' or just 'port' or' / path/to/unix/socket' 127.0.0.1 Set listen (2) backlog-1 Set permissions for unix socket, if one used. In Linux read/write permissions must be set in order to allow connections from web server. Many BSD-derrived systems allow connections regardless of permissions. 0666 Additional php.ini defines, specific to this pool of workers. / usr/sbin/sendmail-t-I 1 Unix user of processes nobody Unix group of processes nobody Process manager settings Sets style of controling worker process count. Valid values are 'static' and' apache-like' static Sets the limit on the number of simultaneous requests that will be served. Equivalent to Apache MaxClients directive. Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi Used with any pm_style. 200 Settings group for 'apache-like' pm style Sets the number of server processes created on startup. Used only when 'apache-like' pm_style is selected 20 Sets the desired minimum number of idle server processes. Used only when 'apache-like' pm_style is selected 5 Sets the desired maximum number of idle server processes. Used only when 'apache-like' pm_style is selected 250Time limit on waiting execution of single request Should be used when' max_execution_time' ini option does not terminate execution for some reason 31s Set open file desc rlimit 51200 Set max core size rlimit 0 Chroot to this directory at the start Chdir to this directory at the start Redirect workers' stdout and stderr into main error log. If not set, they will be redirected to / dev/null, according to FastCGI specs yes How much requests each process should execute before respawn. Useful to work around memory leaks in 3rd party libraries. For endless request processing please specify 0 Equivalent to PHP_FCGI_MAX_REQUESTS 51200 Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect. Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2 +) Makes sense only with AF_INET listening socket. 127.0.0.1 Pass environment variables like LD_LIBRARY_PATH All $VARIABLEs are taken from current environment $HOSTNAME / usr/local/bin:/usr/bin:/bin / tmp / tmp / tmp $OSTYPE $MACHTYPE 2
In order for Nginx+PHP configuration to support
Location ~. *\ .php? ${include fcgi.conf; # fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1 fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 9000; fastcgi_index index.php;}
Add the above paragraph to my server section and create the fcgi.conf file in the / usr/local/nginx/conf/ directory
Vi / usr/local/nginx/conf/fcgi.conf
Fastcgi_param GATEWAY_INTERFACE CGI/1.1
Fastcgi_param SERVER_SOFTWARE nginx
Fastcgi_param QUERY_STRING $query_string
Fastcgi_param REQUEST_METHOD $request_method
Fastcgi_param CONTENT_TYPE $content_type
Fastcgi_param CONTENT_LENGTH $content_length
Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
Fastcgi_param SCRIPT_NAME $fastcgi_script_name
Fastcgi_param REQUEST_URI $request_uri
Fastcgi_param DOCUMENT_URI $document_uri
Fastcgi_param DOCUMENT_ROOT $document_root
Fastcgi_param SERVER_PROTOCOL $server_protocol
Fastcgi_param REMOTE_ADDR $remote_addr
Fastcgi_param REMOTE_PORT $remote_port
Fastcgi_param SERVER_ADDR $server_addr
Fastcgi_param SERVER_PORT $server_port
Fastcgi_param SERVER_NAME $server_name
# PHP only, required if PHP was built with-- enable-force
-cgi-redirect
# fastcgi_param REDIRECT_STATUS 200
[root@test php-5.2.6] # / usr/local/nginx/sbin/nginx-t
2008-09-09 11:12:23 [info] 17512#0: the configuration file
/ usr/local/nginx/conf/nginx.conf syntax is ok
2008-09-09 11:12:23 [info] 17512#0: the configuration file
/ usr/local/nginx/conf/nginx.conf was tested successfully
[root@test php-5.2.6] # / usr/local/nginx/sbin/nginx
This is the end of the brief introduction to the process related to Nginx+PHP configuration. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.