淡淡回忆 发表于 2018-11-13 13:05:09

nginx安装CentOS6,支持php

  1. Install nginx from Ngnix web with stable version
  vi /etc/yum.repos.d/nginx.repo
  
  name=nginx repo
  baseurl=http://nginx.org/packages/centos/6/x86_64/
  gpgcheck=0
  enabled=1
  yum -y install nginx
  vi /etc/nginx/nginx.conf
  #set it within number of CPU cores
  worker_processes 2;
  #uncomment ( enable gzip )
  gzip on;
  vi /etc/nginx/conf.d/default.conf
  #change to your server's name
  server_name 192.168.2.5;
  service nginx start; chkconfig nginx on
  2. enable centos 6 updates repo
  yum -y install php php-mbstring php-pear php-fpm
  vi /etc/php.ini
  date.timezone = Asia/Shanghai
  expose_php = Off
  magic_quotes_gpc = Off
  short_open_tag = On
  vi /etc/php-fpm.d/www.conf
  user = nginx
  group = nginx
  service php-fpm start; chkconfig php-fpm on
  vi /etc/nginx/conf.d/default.conf
  # add follows in a "server" section
  location ~ \.php$ {
  root   /usr/share/nginx/html;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
  include      /etc/nginx/fastcgi_params;
  }
  service nginx restart
  echo "" > /usr/share/nginx/html/info.php

页: [1]
查看完整版本: nginx安装CentOS6,支持php