您的位置:首页 > 运维架构 > Nginx

nginx 编译安装与配置

2017-06-03 16:11 351 查看
hello ,大家好,我是jordy;欢迎大家光临我的博客,我的联系方式有(qq): 1760282809,363232564  欢迎同行多多交流,一起学习,一起进步!

到官网上下载nginx源码包.
http://nginx.org/download/nginx-1.10.3.tar.gz http://nginx.org/download/nginx-1.12.0.tar.gz
新建一个普通用户,禁系统登录 -M 表示不自动创建用户目录

useradd nginx -s /sbin/nologin -M

解压源码包后进入源码目录

修改源码的以下文件,隐藏服务器名称和版本号:

1./usr/local/src/nginx/v1_10_3/nginx-1.10.3/src/core/nginx.h 

2./usr/local/src/nginx/v1_10_3/nginx-1.10.3/src/http/ngx_http_header_filter_module.c 49行

3./usr/local/src/nginx/v1_10_3/nginx-1.10.3/src/http/ngx_http_special_response.c 21 到 30行

运行:

--prefix=/home/work/app/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

安装成功后启动./sbin/nginx 测试一下;

更多配置细节,待续~

升级与扩展nginx 
http://www.cnblogs.com/lixigang/articles/5130052.html http://blog.csdn.net/ystyaoshengting/article/details/48436409
其他一些细节我会很快补充进去:

yum install -y lrzsz

useradd work -s /sbin/nologin -M

yum install -y pcre* zlib* openssl* gd-devel

mkdir -p /home/work/app/nginx

 ./configure --prefix=/home/work/app/nginx/  \

--user=work \

--group=work \

--with-http_ssl_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--with-pcre \

--with-ipv6 \

--with-http_sub_module \

--with-http_dav_module \

--with-http_flv_module \

--with-http_mp4_module \

--with-http_realip_module \

--with-http_image_filter_module 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: