添加第三方源:php
yum install epel-release
安裝nginx:html
yum install nginx
安裝php:mysql
yum install php php-fpm php-mbstring php-mysql php-gd php-fastcgi php-cgi
安裝redis:nginx
yum install redis
添加nginx 默認主頁index.php:redis
vim /etc/nginx/conf.d/default.conf
配置nginx支持phpsql
location / { root /usr/share/nginx/html; index index.html index.htm index.php; }
配置nginx支持phpapache
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
配置php-fpmvim
vim /etc/php-fpm.d/www.conf
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx
chkconfig php-fpm on #設置php-fpm自啓動bash
service nginx restart #從新啓動nginxphp-fpm
service php-fpm start #啓動php-fpm