Centos下编译安装nginx

Posted Kevin_1967

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
      }

 

以上是关于Centos下编译安装nginx的主要内容,如果未能解决你的问题,请参考以下文章

Centos下编译安装nginx

CentOS下编译安装nginx及配置缩略图插件的方法教程

CentOS下编译安装Nginx

centos7下编译安装nginx并实现日志轮替

Linux(CentOS6.5)下编译安装Nginx1.10.1

Linux(CentOS6.5)下编译安装Nginx1.10.1