Nginx php-fpm php mysql

时间:2021-07-30 20:22:49
  1. rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
  2. yum -y install nginx
  3. yum -y php-fpm
  4. service php-fpm restart
  5. service nginx restart
  6. chkconfig php-fpm on
  7. chkconfig nginx on
    1. server {
    2. listen       80;
    3. server_name  localhost;
    4. autoindex    on;
    5. #charset koi8-r;
    6. #access_log  /var/log/nginx/log/host.access.log  main;
    7. location / {
    8. root   /var/www/html;
    9. index  index.html index.htm index.php;
    10. }
    11. location ~ \.php$ {
    12. root           /var/www/html;
    13. fastcgi_pass   127.0.0.1:9000;
    14. fastcgi_index  index.php;
    15. fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;  # $document_root
    16. include        fastcgi_params;
    17. }....

vi /var/www/html/index.php

<?php
phpinfo();
?>