Nginx Add PHP Support

Source: Internet
Author: User
Tags fpm
  1. Background introduction
    The default installation of Nginx is unable to open the PHP file, you need to modify the relevant configuration to support PHP
  2. Installation
    Yum-y Install Epel-release
    Yum-y Install Nginx
    Yum Install PHP php-mysql php-fpm
    Vi/etc/php.ini
    Modify Cgi.fix_pathinfo=0
    Sed-i "S/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g"/etc/php.ini
    Vi/etc/php-fpm.d/www.conf
    Append a listen parameter:
    Listen =/var/run/php-fpm/php-fpm.sock
    Service PHP-FPM Restart
    Chkconfig PHP-FPM on
  3. Modify the Nginx virtual host file to support the PHP
    Location ~ \.php$ {
    Try_files $uri = 404;
    Fastcgi_pass Unix:/var/run/php-fpm/php-fpm.sock;
    Fastcgi_index index.php;
    Fastcgi_param script_filename $document _root$fastcgi_script_name;
    Include Fastcgi_params;
    }
    Restart Nginx Service
    Service Nginx Restart

Nginx Add PHP Support

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.