filts 发表于 2018-11-13 11:41:04

Linux学习之路-Nginx(4)模块简要介绍篇【27】---20180228

#yum install php-fpm  
#vim /etc/php-fpm.d/www.conf
  
listen = 9000
  
#listen.allowed_clients = 127.0.0.1
  
#ss -ntl
  
State   Recv-Q Send-Q    Local Address:Port   Peer Address:Port
  
LISTEN   0   128      *:9000          *:*
  
#mkdir /data/php -pv
  
mkdir: created directory ‘/data’
  
mkdir: created directory ‘/data/php’
  
#vim /data/php/index.php
  

  
#vim /etc/nginx/conf.d/vhosts.conf
  
      location ~* \.php$ {
  
                proxy_pass http://172.18.68.103;
  
      }
  
}
  
#ip a
  
2: eth0:mtu 1500 qdisc pfifo_fast state UP qlen 1000
  
    link/ether 00:0c:29:14:fe:3c brd ff:ff:ff:ff:ff:ff
  
    inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
  
3: eth1:mtu 1500 qdisc pfifo_fast state UP qlen 1000
  
    link/ether 00:0c:29:14:fe:46 brd ff:ff:ff:ff:ff:ff
  
    inet 172.18.68.100/16 brd 172.18.255.255 scope global eth1
  

  
#vim /etc/nginx/nginx.conf
  
    server {
  
      listen       80 default_server;
  
      root    /data/php/;
  
      location / {
  
                fastcgi_pass    172.18.68.200:9000;
  
                fastcgi_index   index.php;
  
                fastcgi_param   SCRIPT_FILENAME /data/php$fastcgi_script_name;
  
                include         fastcgi_params;
  
      }
  

  
    }
  
#curl -I 192.168.1.100/index.php
  
HTTP/1.1 200 OK
  
Server: nginx/1.12.2
  
Date: Fri, 09 Mar 2018 14:09:42 GMT
  
Content-Type: text/html
  
Connection: keep-alive
  
X-Powered-By: PHP/5.4.16
  
X-Via: 192.168.1.100
  
X-Accel: www.a.com


页: [1]
查看完整版本: Linux学习之路-Nginx(4)模块简要介绍篇【27】---20180228