Skip to content

Instantly share code, notes, and snippets.

@happyj2me
Last active April 29, 2020 02:27
Show Gist options
  • Save happyj2me/82e42212cd54f3f98d747d7f9540a7e5 to your computer and use it in GitHub Desktop.
Save happyj2me/82e42212cd54f3f98d747d7f9540a7e5 to your computer and use it in GitHub Desktop.
killall 命令没有找到: yum install psmisc
目的:让nginx把php的解析交给php-fpm程序,双方进程通过unix-socket文件: /run/php/php7.0-fpm.sock 进行通信
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w-fpm
cd /etc/php-fpm.d/
vim www.conf
;listen = 127.0.0.1:9000 ---- 这行注释掉
listen = /run/php/php7.0-fpm.sock
mkdir -p /run/php
systemctl restart php-fpm.service
chmod 777 /run/php/php7.0-fpm.sock
systemctl status php-fpm.service
nginx /etc/nginx配置目录下需要一个 fastcgi.conf , 还需要一个 snippets/fastcig-php.conf , 这两个文件从拥有该文件的nginx上拷贝即可
/etc/nginx/conf.d/mcu.conf:
server{
listen 8188;
server_name rtc.mcu.com;
root /var/www/ice;
error_log /tmp/nginx/mcu_error.log;
access_log /tmp/nginx/mcu_access.log main;
location / {
proxy_pass http://192.168.31.163:8188;
proxy_read_timeout 7200;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X‐Real‐IP $remote_addr;
proxy_set_header X‐Forwarded‐For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
nginx -s reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment