Centos下编译安装nginx

1.安装依赖
yum install -y pcre-devel zlib-devel gcc openssl-devel gd-devel

2.下载安装包

不同版本的nginx下载地址:http://nginx.org/download
wget http://nginx.org/download/nginx-1.15.6.tar.gz
tar zxvf nginx-1.15.6.tar.gz
cd nginx-1.15.6
./configure --prefix=/opt/soft/nginx
make && make install
cd /opt/soft/nginx

3.基本配置nginx反代php-fpm配置

location / {
            root /opt/soft/project/public;
            try_files $uri $uri/ /index.php?$query_string;
        }

location ~ \.php$ {
        root /opt/soft/project/public;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
      }

 

posted @ 2018-11-14 11:34  TomasWangkai  阅读(101)  评论(0编辑  收藏  举报