Home > Backend Development > PHP Tutorial > Configuring Gentoo to run php in FastCGI mode

Configuring Gentoo to run php in FastCGI mode

WBOY
Release: 2016-07-25 09:07:32
Original
1089 people have browsed it
  1. echo "dev-lang/php fpm" >> /etc/portage/package.use
  2. emerge -av dev-lang/php
Copy the code

The configuration is very simple, my local machine The version is php5.4, then edit the file /etc/php/fpm-php5.4/php-fpm.conf and modify the listen address

  1. ;listen = 127.0.0.1:9000
  2. listen = /var/run/php-fpm.sock
Copy code

nginx

Turn on fastcgi USE flag

  1. echo "www-servers/nginx fastcgi" >> /etc/portage/package.use
  2. emerge -av www-servers/nginx
Copy code

Edit /etc/nginx/ nginx.conf

  1. location ~ .*.php$ {
  2. fastcgi_pass unix:/var/run/php-fpm.sock;
  3. fastcgi_index index.php;
  4. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  5. include fastcgi_params;
  6. }
Copy code

lighttpd

Turn on php USE flag

  1. echo "www-servers/lighttpd php" >> /etc/portage/package.use
  2. emerge -av www-servers/lighttpd
Copy code

Edit /etc/lighttpd/ mod_fastcgi.conf

  1. server.modules += ("mod_fastcgi")
  2. fastcgi.server = ( ".php" =>
  3. ( "localhost" =>
  4. (
  5. "socket" => "/var/ run/php-fpm.sock",
  6. )
  7. )
  8. )
  9. fastcgi.map-extensions = ( ".php3" => ".php", ".php4" => ".php", ".php5 " => ".php" )
Copy code

apache

First you need to install www-apache/mod_fastcgi_handler

  1. emerge -av www-apache/mod_fastcgi_handler
Copy the code

At the same time, PHP needs to open the apache2 USE flag

  1. echo "dev-lang/php apache2" >> /etc/portage/package.use
  2. emerge -av dev-lang/php
Copy code

Edit file /etc/apache2 /modules.d/70_mod_php5.conf, tell apache2 the path of php-fpm sock

  1. # AddHandler application/x-httpd-php .php .php5 .phtml
  2. # AddHandler application/x-httpd-php-source .phps
  3. AddHandler fcgi:/var/ run/php-fpm.sock .php .php5
Copy code

Edit file /etc/apache2/modules.d/20_mod_fastcgi_handler.conf

  1. LoadModule fastcgi_handler_module modules/mod_fastcgi_handler.so
Copy code

Edit file /etc/conf .d/apache2, add after -D php5 -D FASTCGI_HANDLER, tells apache2 to start in fastcgi-handler mode, similar to the following configuration:

  1. APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D FASTCGI_HANDLER"
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template