一、配置域名解析8.8.8.8/ #保證能夠上網php
二、下載RPM包(centos6.5) #最好下載到/etc/yum.repos.d/html
三、安裝並啓用下載的RPM包nginx
Rpm -ivh xxx
sed -i ‘s/enabled=0/enabled=1/g’ remi.repo
複製代碼
四、Nginx1.15的yum源sql
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
gpgcheck=1
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/6/$basearch/
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
gpgcheck=1
複製代碼
五、yum安裝nginx,php-fpm,php-mysql #此處php版本使用的是5.5centos
Apache+php遷移到Nginx+php-fpm修改配置文件
一、修改nginx配置文件
1)nginx.conf
user vmuser; #保證用戶對目錄有r權限便可
error_log /var/log/nginx/error.log crit; #忽略大部分錯誤日誌,因php版本問題會產生大量提示類的錯誤日誌
events {
worker_connections 102400;
use epoll;
}
2)Default.conf
Server {
root /var/www/html;
location / {
root /var/www/html;
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:7000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
二、修改php-fpm配置文件
Php.ini
date.timezone = Asia/Shanghai #修改時區
www.conf
listen = 127.0.0.1:7000
User = vmuser #此處用戶和組要對網站根目錄有rx權限
Group = vmuser
複製代碼