CentOS 7 编译安装Nginx
来源:互联网 发布:罗斯文数据库 编辑:程序博客网 时间:2024/05/19 17:26
一、准备工作:
1、安装必备工具:
$ yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel
说明:
pcre: 用来作地址重写的功能。
zlib:nginx 的gzip模块,传输数据打包,省流量(但消耗资源)。
openssl:提供ssl加密协议。
2、安装之前,最好检查一下是否已经安装有nginx
$ find -name nginx
如果系统已经安装了nginx,那么就先卸载
$ yum remove nginx
如果系统已经安装了nginx,那么就先卸载
二、Nginx编译安装:
1、下载Nginx:http://nginx.org/en/download.html
$ cd /usr/local
$ wget http://nginx.org/download/nginx-1.13.0.tar.gz
2、解压编译:
$ tar -zxvf nginx-1.13.0.tar.gz
$ cd nginx-1.13.0/
$ ./configure \
--prefix=/home/programs/nginx \
--sbin-path=/home/programs/nginx/sbin/nginx \
--conf-path=/home/programs/nginx/nginx.conf \
--error-log-path=/home/programs/nginx/custdata/logs/error.log \
--http-log-path=/home/programs/nginx/custdata/logs/access.log \
--pid-path=/home/programs/nginx/custdata/run/nginx.pid \
--lock-path=/home/programs/nginx/custdata/lock/nginx.lock \
--user=nginx --group=nginx \
--http-client-body-temp-path=/home/programs/nginx/custdata/tmp/client_temp \
--http-proxy-temp-path=/home/programs/nginx/custdata/tmp/proxy_temp \
--http-fastcgi-temp-path=/home/programs/nginx/custdata/tmp/fastcgi_temp \
--http-uwsgi-temp-path=/home/programs/nginx/custdata/tmp/uwsgi_temp \
--http-scgi-temp-path=/home/programs/nginx/custdata/tmp/scgi_temp \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-file-aio \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
上面的参数的作用可以通过--help来查看下文附加1中有提供
3、安装:
$ make && make install
4、启动:
5、其它:
停止:
$ /home/programs/nginx/sbin/nginx -s stop
查看版本及安装的模块(大写的V):
$ /home/programs/nginx/sbin/nginx -V
1、安装必备工具:
$ yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel
说明:
pcre: 用来作地址重写的功能。
zlib:nginx 的gzip模块,传输数据打包,省流量(但消耗资源)。
openssl:提供ssl加密协议。
2、安装之前,最好检查一下是否已经安装有nginx
$ find -name nginx
如果系统已经安装了nginx,那么就先卸载
$ yum remove nginx
如果系统已经安装了nginx,那么就先卸载
二、Nginx编译安装:
1、下载Nginx:http://nginx.org/en/download.html
$ cd /usr/local
$ wget http://nginx.org/download/nginx-1.13.0.tar.gz
2、解压编译:
$ tar -zxvf nginx-1.13.0.tar.gz
$ cd nginx-1.13.0/
$ ./configure \
--prefix=/home/programs/nginx \
--sbin-path=/home/programs/nginx/sbin/nginx \
--conf-path=/home/programs/nginx/nginx.conf \
--error-log-path=/home/programs/nginx/custdata/logs/error.log \
--http-log-path=/home/programs/nginx/custdata/logs/access.log \
--pid-path=/home/programs/nginx/custdata/run/nginx.pid \
--lock-path=/home/programs/nginx/custdata/lock/nginx.lock \
--user=nginx --group=nginx \
--http-client-body-temp-path=/home/programs/nginx/custdata/tmp/client_temp \
--http-proxy-temp-path=/home/programs/nginx/custdata/tmp/proxy_temp \
--http-fastcgi-temp-path=/home/programs/nginx/custdata/tmp/fastcgi_temp \
--http-uwsgi-temp-path=/home/programs/nginx/custdata/tmp/uwsgi_temp \
--http-scgi-temp-path=/home/programs/nginx/custdata/tmp/scgi_temp \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_auth_request_module \
--with-file-aio \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
上面的参数的作用可以通过--help来查看下文附加1中有提供
3、安装:
$ make && make install
4、启动:
$ /home/programs/nginx/sbin/nginx
如果没有nginx用户,需要增加
useradd -s /sbin/nologin -M nginx
5、其它:
停止:
$ /home/programs/nginx/sbin/nginx -s stop
查看版本及安装的模块(大写的V):
$ /home/programs/nginx/sbin/nginx -V
阅读全文
0 0
- CentOS 7 编译安装Nginx
- CentOS 7 编译安装Nginx
- centos 编译安装nginx
- Centos编译安装nginx
- CentOS 7 编译安装 Nginx 1.9.7
- CentOS源码编译安装Nginx
- Centos下编译安装nginx
- CentOS 7.1编译安装nginx
- CentOS 编译安装 php7 + nginx
- centos下nginx编译安装
- CentOS 下编译安装 Nginx
- 【Nginx】CentOS下编译安装nginx
- (四)CentOS 7安装Nginx(编译安装)
- CentOS 7 上编译安装Nginx,搭建PHP运行环境。
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境
- CentOS 7 安装 nginx
- [CentOS 7] 安装nginx
- CentOS 7安装Nginx
- Math ceil()、floor()、round()方法
- 抽象类和接口
- sklearn.cluster.KMeans 报错 ValueError: n_samples=1 should be >= n_clusters=10
- 网络安全与主机基本防护:限制端口、网络升级与SELinux
- 模式匹配之(BF KMP算法)
- CentOS 7 编译安装Nginx
- Linux中,top命令查看CPU利用率
- 每日一题--两个链表的第一个公共结点
- 911-917提升--本周计划
- 平衡二叉树(AVL)的创建、插入、删除
- 系统学习,系统掌握知识与技能
- 前端常用插件地址
- .NET Core2.0 MVC中使用EF访问数据
- next数组