Nginx

 

 

1◆ nginx install

  1. 源码:https://trac.nginx.org/nginx/browser
  2.  
  3. 官网:http://www.nginx.org/

 

 

 

=====>安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

 

 

=====>下载 PCRE 安装包

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

 

=====>解压安装包

tar zxvf pcre-8.35.tar.gz

cd pcre-8.35

 

=====>编译安装

./configure

 

make && make install

 

 

=====>search version

 

pcre-config --version

 

 

 

=====>下载 Nginx

 

wget http://nginx.org/download/nginx-1.6.2.tar.gz

 

 

=====>unrar

 

tar zxvf nginx-1.6.2.tar.gz

 

cd nginx-1.6.2

 

 

=====>编译安装

./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35

 

make

make install

 

 

./configure

 

make

make install

 

=====>search nginx version

 

/usr/local/webserver/nginx/sbin/nginx -v

 

创建 Nginx 运行使用的用户 www

 

[root@bogon conf]#
/usr/sbin/groupadd www 

[root@bogon conf]#
/usr/sbin/useradd -g www www

 

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y openssl openssl-devel

 

=====>

tar -zxvf nginx-1.6.2.tar.gz -C /usr/local/

 

tar -zxvf nginx-1.6.2.tar.gz -C /usr/local/

 

=====>进行configure配置

 

./configure --prefix=/usr/local/nginx

 

make && make install

 

/usr/local/nginx/sbin/nginx

 

=====>ps -ef | grep nginx

 

=====>close ngnix

/usr/local/nginx/sbin/nginx -s stop

 

=====>重新热启动nginx

重新热启动nginx

 

=====>配置防火墙,nginx默认的端口是80

 

firewall-cmd --zone=public --add-port=80/tcp –permanent

firewall-cmd --reload

 

 

 

worker_processes 1;

 

events {

worker_connections 1024;

}

 

http {

 

include mime.types;

default_type application/octet-stream;

sendfile on;

    upstream mytest {

server 10.2.4.149:8080;

}

server {

listen 8080;

server_name 192.168.163.4;

index devices.html;

        root /home/wonders/work/app_download;

        location ~ /test/(.*) {

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass http://mytest;

}

 

}

 

log_format access '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $http_x_forwarded_for' server_ip $server_addr proxy_host $proxy_host upstream_server_ip $upstream_addr';

access_log logs/access.log access;

    
 

 

}

 

}

 

 

 

 

=====> gzip

gzip on; #开启gzip

gzip_min_length 1k; #低于1kb的资源不压缩

gzip_comp_level 3; #压缩级别【1-9】,越大压缩率越高,同时消耗cpu资源也越多,建议设置在4左右。

gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css; #需要压缩哪些响应类型的资源,多个空格隔开。不建议压缩图片,下面会讲为什么。

gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)

gzip_vary on; #是否添加"Vary: Accept-Encoding"响应头

az nginx install and other的更多相关文章

  1. CentOS 6.6 nginx install

    /************************************************************************* * CentOS 6.6 nginx instal ...

  2. nginx install in centos

    1.在nginx下载rpm包,如nginx-release-centos-6-0.el6.ngx.noarch.rpm ,并安装(可用yum直接安装): 注:rpm包只是提供一个nginx源. 2.使 ...

  3. 第七篇、Nginx Install On Mac

    方式一: 在mac上安装nginx,依次安装对应的依赖 pcre ./configure --prefix=/usr/local/pcre-8.37 --libdir=/usr/local/lib/p ...

  4. nginx install lua module

    #install luajit #http://luajit.org/download.html .tar.gz cd LuaJIT- make install PREFIX=/home/allen. ...

  5. Nginx Install 记录

    一.安装编译工具及库文件 yum -y install gcc yum -y install gcc-c++ yum -y install zlib; yum -y install pcre-deve ...

  6. centos nginx install openssl

    1.查看是否已经安装 ssl 组件 [root@localhost wwwlogs]# cd /usr/local/nginx/sbin/ [root@localhost sbin]# ./nginx ...

  7. nginx install

    ./configure --prefix=/home/allen.mh/local/nginx --with-http_ssl_module --with-http_sub_module --with ...

  8. nginx HttpLuaModule

    http://wiki.nginx.org/HttpLuaModule#Directives Name ngx_lua - Embed the power of Lua into Nginx This ...

  9. LVS+Keepalived+Squid+Nginx+MySQL主从高性能集群架构部署方案

    方案一,在tomcat的workers.properties里面配置相关条件 worker.tomcat.lbfactor= worker.tomcat.cachesize= worker.tomca ...

随机推荐

  1. 日期时间函数 mysql 和sqlserver 中对于常用函数的日期和时间函数的区别

    1. sqlserver中获取时间用getdate(),默认返回格式是2019-01-21 13:58:33.053,具体的年月日,时分秒毫米,年月日之间用短线连接,时分秒之间用冒号连接,秒和毫米之间 ...

  2. 本地Windows上安装 MySQL数据库

    1.首先下载mysql安装文件,下载地址:https://dev.mysql.com/downloads/mysql/ 2.将下载下来的压缩包解压到本地一个文件夹中 3.在文件根目录下新增my.ini ...

  3. leecode第十四题(最长公共前缀)

    class Solution { public: string longestCommonPrefix(vector<string>& strs) { string res=&qu ...

  4. 基于python Arcface 实现人脸检测和识别

    虹软的人脸识别技术也是很强的,重要的是他免费提供了离线的sdk,还提供了实例,这个是目前几家研究人脸识别的大公司里面少有的.识别能力正常用还是可以的.我这个代码是调用的离线sdk实现的 ``` fro ...

  5. AD绘制PCB时,贴片封装器件的焊盘间距小于10Mil,报错解决

    Design->Rules->Manufacturing->Minimum Solder Mask Sliver

  6. 将本地项目上传到gitlab下

    转载自: https://blog.csdn.net/litianxiang_kaola/article/details/74075151 1.安装git    https://git-scm.com ...

  7. poi实现百万级数据导出

    注意使用 SXSSFWorkbook 此类在构造表格和处理行高的时候效率极高,刚开始时我使用的 XSSFWorkbook 就出现构造表格效率极低,一万行基本需要3秒左右,那当导出百万级数据就慢的要死啦 ...

  8. CentOS7 上安装 Lua5.3

    1.CentOS7默认已经安装了5.1.4 ①查看当前lua版本号:lua -v Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio ②查看lua和 ...

  9. lua --- 点号 和 冒号

    冒号的作用:1.定义函数时,给函数添加隐藏的第一个参数 self2.调用函数时,默认把当前调用者作为第一个参数传递进去 如 a:b(c) 可以理解为 a.b(a, c) 以下是用点号的定义和调用函数的 ...

  10. jenkins之从0到1利用Git和Ant插件打war包并自动部署到tomcat(第五话):总结以及build.xml文件

    前面基本上把整个配置过程都完整地串起来了,包括可能遇到的难点,按照那个套路应该可以配置好自动打包发布的功能.简单总结下我的学习过程,以及遇到问题是怎样解决的. 准备一个项目源码 刚开始在github和 ...