下载安装包
wget http://nginx.org/download/nginx-1.17.0.tar.gz
tar -zxvf nginx-1.17.0.tar.gz
cd nginx-1.17.0
./configure --prefix=/usr/local/nginx
编译成功,执行安装
make && make install
安装完成
启动nginx
/usr/local/nginx/sbin/nginx
关闭nginx
/usr/local/nginx/sbin/nginx -s stop
查看当前nginx安装版本
/usr/local/nginx/sbin/nginx -V
Nginx配置加载php
在server的配置项中打开下面注释
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
运行phpinfo查看已经加载成功
PHP的安装接上文:https://www.jianshu.com/p/644b8cae7a34