1. yum install nginx
2. yum install epel-release
下面增加PHP7的源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
下面正式安装php7-fpm
yum install php70w-fpm php70w-cli php70w-gd php70w-mcrypt php70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel
进入nginx的配置目录/etc/nginx 编辑nginx.conf 这个文件
下面我们在conf.d 这个目录中创建站点的配置文件,例如first.conf ?文件中的内容如下
server {
listen 80;
server_name (站点域名 没有就用IP代替);
root /www/tiga(网站根目录);
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
下面启动nginx 启动: service nginx start 停止: service nginx stop 检查配置文件是否正确: nginx -t
启动php-fpm 启动: service php-fpm start 停止: service php-fpm stop 检查配置文件是否正确: php-fpm -t
Windows 安装php 然后启动 在php.exe所在文件夹 cmd执行
php-cgi.exe -b 127.0.0.1:9000 -c php.ini
window nginx 配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 192.168.0.103;
root C:/tigophp/www/moesys/sites/tigo-web/www;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
//----?
|