centos7.2 NGINX 源码安装编译

 

 条件介绍 

   百度云  

  • 密集计算型ic3 CPU:2核
  • 内存:2GB 磁盘:40G
  •  CentOS / 7.2 x86_64 (64bit) 

1、安装相关的依赖包

[root@centos7_4 ~]# yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre*

2、 创建nginx运行用户

[root@centos7_4 ~]# useradd -M -s /sbin/nologin nginx

下载pcre包

[root@centos7_4 ~]# wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.zip

[root@centos7_4 ~]# unzip pcre-8.42.zip -d /usr/local/src/

3、 下载nginx源码包并解压

[root@centos7_4 ~]# wget http://nginx.org/download/nginx-1.14.0.tar.gz

[root@centos7_4 ~]# tar zxf nginx-1.14.0.tar.gz -C /usr/local/src/

[root@centos7_4 ~]# cd /usr/local/src/nginx-1.14.0/

 

./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --user=nginx --group=nginx --with-pcre=/usr/local/src/pcre-8.42     

#这个是可选项,如果yum安装了依赖包这里也可以不用

make  && make install

4、 修改配置文件

[root@centos7_4 nginx-1.14.0]# vim /usr/local/nginx/conf/nginx.conf    

    user  nginx nginx;      #修改用户和组

        location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

    fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;    #修改路径

            include        fastcgi_params;

        }

posted @   xyz叶子  阅读(62)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示