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.confuser 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.confserver { 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.confserver { 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 ...
随机推荐
- Django框架之数据库ORM框架
首先,我来介绍一下什么是ORM框架: O是object,也就类对象的意思,R是relation,翻译成中文是关系,也就是关系数据库中数据表的意思,M是mapping,是映射的意思.在ORM框架中,它帮 ...
- 解决apt-get命令出现的安装源错误
首先linux环境下打开网页,输入上网账号密码,确保已经联网 直接安装软件或库的时候,在管理员模式下,在终端输入:apt-get install A可以自动安装A 有时会出现下面的安装源错误 这是因为 ...
- JAVA读取yml配置文件指定key下的所有内容
先引入需要的依赖 <!--读取yml文件--> <dependency> <groupId>org.yaml</groupId> <artifac ...
- 比特币学习笔记(一)---在windows下编译搭建比特币环境
最近打算研究下比特币源码,却发现这套源码正常情况下得在linux下编译运行,而我的机器是windows的. 怎么办呢? 起初打算用mingw和cygwin搞搞看,试了许久后发现行不通,必须转到linu ...
- CentOS6.5源码安装mysql-5.5.21
本文参考自 http://www.cnblogs.com/ShanFish/p/6531365.html,但不局限于它. 一. 卸载旧版本 .检查是否安装mysql组件 # rpm -qa | gre ...
- cesium加载WFS服务(GeoServer发布)
需求: 为了便于前端渲染数据,自定义图层渲染. 思路: 获取地图服务中的要素进行渲染. 工具: GeoServer 2.6.4,cesium, 思路有了就开始找资料写代码,cesium有接口可以加载W ...
- 分享一款基于aui框架的图文发布界面
本文出自APICloud官方论坛, 感谢论坛版主 川哥哥 的分享. 分享一款基于aui框架的图文发布界面,可以添加多张图可以删除,类似qq空间发布说说,没做服务器后端,只演示前端操作.需要用到UIMe ...
- P1640 [SCOI2010]连续攻击游戏 二分图最大匹配 匈牙利算法
题目描述 lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示.当他使用某种装备时,他只能使用该装备的某一个属性.并且每种装备 ...
- Ubuntu18.04 一次性升级Python所有库
pip是什么 pip 是 Python 包管理工具,该工具提供了对Python 包的查找.下载.安装.卸载的功能. 升级pip版本 默认Ubuntu自带的pip (pip 9.0.1)是基于Pytho ...
- 一文搞定Spring Boot + Vue 项目在Linux Mysql环境的部署(强烈建议收藏)
本文介绍Spring Boot.Vue .Vue Element编写的项目,在Linux下的部署,系统采用Mysql数据库.按照本文进行项目部署,不迷路. 1. 前言 典型的软件开发,经过" ...