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. Qt532的QString输出各种编码的16进制数组(测试代码)

    环境:Win7x64.Qt5.3.2 MSVC2010 OpenGL.vs2010 1.只测试了 4种:Utf8.Latin1.Local8Bit.unicode 2.测试代码:(这个是 " ...

  2. Android 虹软免费人脸识别 SDK开发

    目前我们的应用内使用了 ArcFace 的人脸检测功能,其他的我们并不了解,所以这里就和大家分享一下我们的集成过程和一些使用心得集成ArcFace FD 的集成过程非常简单在 ArcFace FD 的 ...

  3. 关于fstream、ifstream、ofstream读写文本文件、二进制文件详解

    fstream.ifstream.ofstream是c++中关于文件操作的三个类 fstream类对文件进行读操作和写操作 打开文件 fstream fs("要打开的文件名",打开 ...

  4. 学习笔记30—Windows那些事

    1.win10编程窗口:powerShell 2.Win7设置工具栏折叠:我们只需要在底部任务栏空白位置点击鼠标右键,然后选择“属性”,在弹出额属性对话框中,将“任务栏按钮”后面的“始终合并.隐藏标签 ...

  5. chkconfig命令参数

    chkconfig命令主要用来更新(启动或停止)和查询系统服务的运行级信息.谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接. 使用语法:chkconfig [--ad ...

  6. ionic service

    当你初试 Angular 时,很自然地就会往 controller 和 scope 里堆满不必要的逻辑.一定要早点意识到,controller 这一层应该很薄:也就是说,应用里大部分的业务逻辑和持久化 ...

  7. echarts的学习

    博客1.:https://zrysmt.github.io/ 博客2:http://blog.csdn.net/future_todo/article/details/60956942 工作中一个需求 ...

  8. (转)C# 构造函数与析构函数

    (1)构造函数<1>除非是static,否则编译器将会给每一个没有构造函数的类指定一个默认的构造函数<2>构造函数private时候,类不能被实例化<3>派生类可以 ...

  9. [mybatis-spring] Transaction 事务/事务处理/事务管理器

    使用mybatis-spring的主要原因之一就是: mybatis-spring允许mybatis参与到spring 事务中. mybatis-spring leverage[use (someth ...

  10. Ubuntu vim终端常用的快捷键

    Ubuntu中常用的快捷键 Ubuntu中的许多操作在终端(Terminal)中十分的快捷,记住一些快捷键的操作更得心应手.在Ubuntu中打开终端的快捷键是Ctrl+Alt+T.其他的一些常用的快捷 ...