Gentoo configuration to run PHP in FastCGI mode

Source: Internet
Author: User
    1. echo "dev-lang/php fpm" >>/etc/portage/package.use
    2. Emerge-av dev-lang/php
Copy Code

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

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

Nginx

Open the 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

Open 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" and ". php", ". PhP5" = ". php")
Copy Code

Apache

First you need to install Www-apache/mod_fastcgi_handler

    1. Emerge-avwww-apache/mod_fastcgi_handler
Copy Code

At the same time PHP needs to open the APACHE2 use tag

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

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

    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 the file/etc/conf.d/apache2, add the-D Fastcgi_handler after the-d php5, and tell 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
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.