Nginx 部署及配置
Tengine + Luajit2
系统账号及环境配置
$ sudo useradd -g 100 -u 200 user_00 $ sudo groupadd -g 300 www $ sudo useradd -g 300 -u 300 -s /sbin/nologin www $ sudo mkdir -p /usr/local/services/src $ sudo chown -R user_00.usrs /usr/local/services $ su - user_00 $ cd /usr/local/services/src |
LuaJIT部署
$ wget http: //luajit .org /download/LuaJIT-2 .1.0-beta2. tar .gz $ tar xf LuaJIT-2.1.0-beta1. tar .gz $ cd LuaJIT-2.1.0-beta1 $ make PREFIX= /usr/local/services $ make install PREFIX= /usr/local/services $ echo "/usr/local/services/lib" | sudo tee -a /etc/ld .so.conf $ sudo ldconfig |
Tengine 部署
$ wget http: //tengine .taobao.org /download/tengine-2 .1.2. tar .gz $ wget ftp : //ftp .lanet.lv /pub/unix/security/libmd5-0 .8.2b. tar .gz $ wget https: //sourceforge .net /projects/pcre/files/pcre/8 .39 /pcre-8 .39. tar .gz /download $ wget https: //www .openssl.org /source/openssl-1 .0.2j. tar .gz $ . /configure \ --prefix= /usr/local/services/tengine-2 .1.2 \ --user=www \ --group=www \ --with-http_ssl_module \ --with-http_lua_module \ --with-http_realip_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-sha1= /usr \ --with-openssl= /usr/local/services/src/openssl-1 .0.2j \ --with-md5= /usr/local/services/src/md5 \ --with-pcre= /usr/local/services/src/pcre-8 .39 \ --with-luajit-inc= /usr/local/services/include/luajit-2 .1 \ --with-luajit-lib= /usr/local/services/lib \ --without-select_module --without-poll_module \ --without-http_userid_module \ --without-mail_pop3_module \ --without-mail_imap_module > /dev/null $ make > /dev/null && make install > /dev/null $ cd /usr/local/services/tengine-2 .1.2 $ mkdir {temp,conf /sites- {available,enabled}} $ sudo chown www.www temp |
Tengine 主配置文件
$ cd /usr/local/services/tengine-2 .1.2 /conf $ cat nginx.conf user www www; worker_processes 2; worker_cpu_affinity auto; pid logs /nginx .pid; error_log logs /error .log error; #Specifies the value for maximum file descriptors that can be opened by this process. events { use epoll; worker_connections 102400; } worker_rlimit_nofile 102400; http { include mime.types; server_info off; server_tokens off; server_tag off; default_type application /octet-stream ; real_ip_header X-Forwarded-For; set_real_ip_from 172.31.0.0 /16 ; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $request_time $upstream_response_time $host' ; server_names_hash_bucket_size 256; client_header_buffer_size 256k; large_client_header_buffers 8 128k; client_max_body_size 8m; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 60; proxy_connect_timeout 100s; proxy_read_timeout 300; proxy_send_timeout 300; proxy_buffer_size 512k; proxy_buffers 16 256k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 512k; proxy_ignore_client_abort on; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text /plain application /javascript application /x-javascript text /css application /xml text /javascript ; gzip_vary on; charset utf-8; access_log logs /access .log main; log_not_found off; ssi on; ssi_silent_errors on; ssi_types text /shtml ; fastcgi_temp_path temp /fastcgi_temp ; client_body_temp_path temp /client_body_temp ; proxy_temp_path temp /proxy_temp ; scgi_temp_path temp /scgi_temp ; uwsgi_temp_path temp /uwsgi_temp ; #error_page 500 502 503 504 /50x.html; #error_page 400 403 405 408 404 /40x.html; req_status_zone server "$host" 256M; req_status_zone_add_indicator server $limit; upstream appname { server 127.0.0.1:8000 weight=1; server 127.0.0.2:8000 weight=1; keepalive 600; check interval=5000 rise=2 fall=5 timeout=1000 type =http; check_keepalive_requests 100; check_http_send "HEAD / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n" ; check_http_expect_alive http_2xx http_3xx; } server { listen 80 default; server_name _; return 444; access_log off; } include sites-enabled/*.conf; } |
Tomcat 动静分离
$ cd /usr/local/services/tengine-2 .1.2 /conf/sites-available $ cat www.soa.com.conf server { listen 80; server_name www.soa.com; root /data/apps/soa/appname ; req_status server; location / { index index.html index.jsp; try_files $uri $uri/ @proxy; } location @proxy { proxy_pass http: //appname ; } location ~ \.jsp$ { proxy_redirect off; proxy_pass http: //www .esearchapi.com; proxy_http_version 1.1; proxy_set_header Connection "" ; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ .*\.(gif|jpg|jpeg|png|bmp)$ { expires 1d; } } |
Tengine 运行状态,用于监控
$ cd /usr/local/services/tengine-2 .1.2 /conf/sites-available $ cat 127.0.0.1.conf server { listen 80; server_name 127.0.0.1; access_log off; set $limit 0; if ($arg_limit = '1' ) { set $limit 1; } location /stats { stub_status on; } location /upstream_stats { check_status; } location /request_stats { req_status_show; req_status_show_field req_total conn_total bytes_in bytes_out rt http_200 http_404 http_403 http_500 http_502 http_503 http_504 http_2xx http_3xx http_4xx http_5xx http_other_status $limit; } } |
Nginx 部署及配置的更多相关文章
- linux下nginx部署以及配置详解
1.下载源码包解压编译 启动多个,请看:在linux系统下安装两个nginx以及启动 查看nginx包路径:http://nginx.org/download/,两种下载方式: 1.在官网下载使用Xf ...
- Nginx 部署、反向代理配置、负载均衡
Nginx 部署.反向代理配置.负载均衡 最近我们的angular项目部署,我们采用的的是Nginx,下面对Nginx做一个简单的介绍. 为什么选择Nginx 轻:相比于Apache,同样的web服务 ...
- 菜鸟nginx源代码剖析 配置与部署篇(一) 手把手实现nginx "I love you"
菜鸟nginx源代码剖析 配置与部署篇(一) 手把手配置nginx "I love you" Author:Echo Chen(陈斌) Email:chenb19870707@gm ...
- Linux中Nginx服务器的部署和配置
目录 Nginx安装方式: yum源安装 目录结构: 源码包安装 目录结构: Nginx中支持PHP Nginx中配置php对mysql数据库的支持 Nginx配置反向代理服务器 正常代理 根据不同端 ...
- 使用nginx部署Django静态文件配置
首先,我们配置静态文件,要在setting.py里面加入如下几行代码: # settings.py # the settings above # STATIC SETTINGS STATIC_URL ...
- Tomcat服务部署与Nginx负载均衡配置
一.中间键产品介绍 目前来说IBM的WebSphere,Oracle的Weblogic占据了市场上java语言Web站点的部分份额,该两种软件都是商业化的软件,由于性能优越,可靠性高等优点应用于大型互 ...
- Nginx部署vue项目的配置
. 官网下载 http://nginx.org/en/download.html 选择stable version nginx/Windows-1.14.1 pgp . 解压 然后配置环境变量,如果环 ...
- CentOS Mono Nginx 部署 MVC4+WebApi
CentOS Mono Nginx 部署 MVC4+WebApi 经过几天的折磨,终于在CentOS上成功部署了MVC4+WebApi.Mono上的服务器推荐两种:Jexus(国产高人写的一款很牛的服 ...
- windows下nginx安装、配置与使用(转载)
目前国内各大门户网站已经部署了Nginx,如新浪.网易.腾讯等:国内几个重要的视频分享网站也部署了Nginx,如六房间.酷6等.新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx ...
随机推荐
- RocketMQ客户端加载流程
这节介绍RocketMQ客户端的启动流程,即Consumer和Producer的启动流程. 1. 客户端demo 首先先看下客户端的demo Producer: public class Sync ...
- wannafly camp day4
2088: 电音之王 描述 题目描述: 终于活成了自己讨厌的样子. 听说多听电音能加快程序运行的速度. 定义一个数列,告诉你a0,a1,m0,m1,ca\_0,a\_1,m\_0,m\_1,ca0, ...
- 构造分组背包(CF)
Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of t ...
- Centos7 搭建Grafana+Jmeter+Influxdb 性能实时监控平台
未完,待更新 背景 日常工作中,经常会用到Jmeter去压测,毕竟LR还要钱(@¥&*...),而最常用的接口压力测试,我们都是通过聚合报告去查看压测结果的,然鹅聚合报告的真的是丑到家了,作为 ...
- MySQL——DOS命令
翻开之前的笔记发现有这么一篇,于是整理了一下发出来加深记忆并分享交流,欢迎纠错,谢谢!!! 1.启动MySQL服务: net start mysql; 2.停止MySQL服务: net stop my ...
- java jdk9的特性 jshell
1.进入 jshell 2.推出 /exit() 和python的解释器用法差不多
- 阿里巴巴Jetcache springboot使用教程
原文地址:https://www.jianshu.com/p/03b289439de2 springboot中使用说明 jetcache原理参见:https://www.jianshu.com/p/8 ...
- 5、python基本数据类型之数值类型
前言:python的基本数据类型可以分为三类:数值类型.序列类型.散列类型,本文主要介绍数值类型. 一.数值类型 数值类型有四种: 1)整数(int):整数 2)浮点数(float):小数 3)布尔值 ...
- L1和L2:损失函数和正则化
作为损失函数 L1范数损失函数 L1范数损失函数,也被称之为最小绝对值误差.总的来说,它把目标值$Y_i$与估计值$f(x_i)$的绝对差值的总和最小化. $$S=\sum_{i=1}^n|Y_i-f ...
- 《阿里巴巴Java开发手册》码出高效详解(一)- 为什么要学习阿里编码手册
<Java 开发手册>(以下简称<手册>)是每个 Java 工程师人手必备的一本参考指南.该手册包括 编程规约.异常日志.单元测试.安全规约.MySQL 数据库.工程结构.设计 ...