Nginx
下载nginx,安装完成后查看其目录结构:
client_body_temp
fastcgi_temp
logs
sbin // 启动 关闭目录
uwsgi_temp
conf // 配置文件所在文件夹
html // index.html 默认显示页面
proxy_temp
scgi_temp
sbin目录下 启动: sudo ./nginx 关闭: sudo ./nginx -s stop
配置文件:
#user nobody;
worker_processes auto;
worker_rlimit_nofile 100000;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 100000;
multi_accept on;
use epoll;
}
http {
// 配置集群
upstream tomcat {
server 192.168.31.10:8080 weight=10;
server 192.168.31.11:8081 weight=10;
server 192.168.31.12:8082 weight=10;
}
upstream touch{
server 127.0.0.1:32222;
}
include mime.types;
include /opt/nginx-1.8.0/conf/proxy.conf;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
access_log off;
#keepalive_timeout 0;
keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
reset_timedout_connection on;
send_timeout 10;
limit_conn_zone $binary_remote_addr zone=addr:5m;
limit_conn addr 60000;
charset UTF-8;
gzip on;
# gzip_static on;
gzip_disable "msie6";
gzip_proxied any;
gzip_min_length 1000;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# cache informations about file descriptors, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /opt/nginx-1.8.0/conf.d/*.conf;
include /opt/nginx-1.8.0/sites-enabled/*;
server {
listen 80;
server_name fruit.tunnel.qydev.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location /admin {
# root html;
# index index.html index.htm;
proxy_pass http://tomcat/admin; // 反向代理
}
location /hsh {
proxy_pass http://touch/hsh;
}
location /mobile {
proxy_pass http://192.168.31.161:8080/mobile;
}
location /uicw {
proxy_pass http://192.168.31.161:8080/uicw;
}
location /trans {
proxy_pass http://192.168.31.161:8080/trans;
}
// 访问静态资源
location /images {
alias /data/fruit/images; // 访问路径: /data/fruit/images
expires 7d;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
charset utf-8;
listen 5555;
server_name localhost;
#location ~* \.(eot|ttf|woff)$ {
# add_header Access-Control-Allow-Origin *;
#}
location /admin/store/maintenance {
#add_header Access-Control-Allow-Origin *;
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /admin/store/enroll {
#add_header Access-Control-Allow-Origin *;
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /admin/help/store/video {
#add_header Access-Control-Allow-Origin *;
proxy_pass http://tomcat1;
}
location /admin/help/agent/video {
#add_header Access-Control-Allow-Origin *;
proxy_pass http://tomcat1;
}
location /admin/agent/store/management{
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /admin/agentManager/store/management{
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /admin/agent/help/video{
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /admin/agentManager/help/video{
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1;
}
location /{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ https://192.168.31.161/$1 redirect;
}
}
# HTTPS server
#
server {
charset utf-8;
access_log logs/https_access.log;
listen 443 ssl;
server_name localhost;
ssl on;
ssl_certificate /opt/nginx-1.8.0/sslkey/server.crt;
ssl_certificate_key /opt/nginx-1.8.0/sslkey/server.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /opt/nginx-1.8.0/sslkey/startssl_trust_chain.crt;
resolver 61.177.7.1 8.8.8.8 8.8.4.4;
add_header Strict-Transport-Security "max-age=31536000";
#location ~* \.(eot|ttf|woff)$ {
# add_header Access-Control-Allow-Origin *;
#}
location /admin/store/maintenance {
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/store/enroll{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/help/store/video{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/agent/store/management{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/agentManager/store/management{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/agent/help/video{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/agentManager/help/video{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin/help/agent/video{
#root html;
#index index.html index.htm;
rewrite ^/(.*)$ http://192.168.31.161:5555/$1 permanent;
}
location /admin {
add_header Access-Control-Allow-Origin http://192.168.31.161:5555;
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1/admin;
}
}
server {
charset utf-8;
listen 9090 ssl;
server_name localhost;
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
ssl_certificate /opt/nginx-1.8.0/ca/server/server.crt;
ssl_certificate_key /opt/nginx-1.8.0/ca/server/server.key;
ssl_client_certificate /opt/nginx-1.8.0/ca/private/ca.crt;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /opt/nginx-1.8.0/sslkey/startssl_trust_chain.crt;
resolver 61.177.7.1 8.8.8.8 8.8.4.4;
add_header Strict-Transport-Security "max-age=31536000";
location /mobile {
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1/mobile;
}
location /storemobile {
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1/storemobile;
}
location /agentmobile {
#root html;
#index index.html index.htm;
proxy_pass http://tomcat1/agentmobile;
}
}
server {
listen 7777;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /mobile/html {
proxy_pass http://tomcat1/mobile/html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
分享到:
相关推荐
**Nginx版本升级步骤详解** 在Web服务器领域,Nginx以其高性能、低内存消耗以及高并发处理能力而备受青睐。随着新版本的发布,可能会包含性能优化、安全修复和新特性,因此定期更新Nginx版本是必要的。本文将详细...
arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构 docker运行nginx镜像包,arm 架构...
Nginx 1.24.0 是 Nginx 开源项目发布的一个重要更新版本,该版本在性能优化、功能增强以及安全性提升方面带来了诸多改进。当您下载 Nginx 1.24.0 的压缩包时,您将获得一个包含 Nginx 源代码的压缩文件,通常命名为 ...
现在,我们可以下载Nginx的源代码包`nginx-1.20.1.tar.gz`。你可以通过wget或者浏览器将文件下载到本地,然后解压: ```bash wget http://nginx.org/download/nginx-1.20.1.tar.gz tar -zxvf nginx-1.20.1.tar.gz cd...
Nginx是一个高性能的Web服务器和反向代理服务器,它以其高效的并发处理能力、低内存占用和稳定性而闻名。在1.23.2版本中,Nginx继续提供了优化和改进,以满足不断变化的互联网需求。这个版本可能是对之前版本的bug...
这个名为"nginx-linux-arm64.zip"的压缩包提供的是专为ARM64架构(也称为AArch64)编译的Nginx版本,适用于基于Linux操作系统的64位ARM处理器设备,如树莓派、某些云服务器或嵌入式系统。无需繁琐的编译过程,只需...
### Nginx 作为 Apache 和 JBoss 的替代方案 #### 背景介绍 随着互联网技术的不断发展,网站流量的增长对服务器性能提出了更高要求。Apache 和 JBoss 是两种广泛使用的 Web 服务器和应用服务器,但在高并发场景下,...
**Nginx 1.13.3 版本详解** Nginx 是一款高性能的 HTTP 和反向代理服务器,广泛应用于网站托管、负载均衡以及应用程序交付等领域。它以其高效、稳定和轻量级的特性著称,尤其在处理静态内容和高并发请求时表现优秀...
此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...
nginx1.18镜像包 使用docker load -i xx.tar 拉取镜像 使用docker images 查看是否成功。 运行容器 docker run --name nginx-test -p 8080:80 -d nginx 参数说明: --name nginx-test:容器名称。 -p 8080:80: ...
在Linux系统中,离线安装Nginx是一个常见的需求,特别是在没有互联网连接或者网络环境受限的服务器上。本文将详细讲解如何通过离线方式在Linux上安装Nginx,同时也会涉及Nginx依赖的软件如openssl和gcc的安装过程。 ...
要配置Nginx进行TCP代理转发,我们需要创建一个新的Nginx配置文件,通常放在`/etc/nginx/conf.d/`目录下,例如命名为`tcp_proxy.conf`。在该文件中,我们需要使用`stream`模块来处理TCP流量。下面是一个基础的配置...
实战nginx.pdf。主要内容包括:第1章 Nginx简介;第2章Nginx服务器安装与配置;第3章Nginx基本配置与优化;第4章Nginx与PHP;第5章Nginx与JSP、ASP.NET..第6章Nginx http负载均衡和反向代理;第7章Nginx 的rewrite...
1. **下载源码**:首先,从Nginx官网获取稳定版本的源代码,例如nginx-1.17.10。同时,从GitHub或其他可靠的来源下载HTTP FLV Module的源代码。 2. **安装编译工具**:Windows上需要安装MinGW或Visual Studio等编译...
"GitLab系统中Nginx版本升级和配置" 在实际生产环境中,GitLab系统的Nginx版本升级和配置是一个非常重要的任务。为确保系统的稳定性和安全性,需要对GitLab系统中的Nginx版本进行升级和配置。本文将详细介绍如何...
Nginx课件完整版.pdf Nginx是一款功能强大的网络服务器软件,能够提供高性能的Web服务器、反向代理、负载均衡等功能。本资源摘要信息将对Nginx的主要知识点进行详细的介绍。 什么是Nginx? Nginx是一个基于C语言...
**Nginx与Nginx-RTMP及Nginx-HTTP-FLV模块** Nginx是一款高性能、轻量级的Web服务器/反向代理服务器,被广泛应用于高并发场景,尤其在处理静态文件、HTTP缓存以及反向代理等方面表现出色。Nginx以其高效的事件驱动...
在IT领域,尤其是在服务器配置和优化的过程中,ARM架构和Nginx扮演着至关重要的角色。ARM(Advanced RISC Machines)架构是一种广泛应用于嵌入式设备、移动设备以及高性能计算的处理器架构,以其低功耗和高效能而...
【标题】: "带nginx-rtmp-module模块的Nginx" 在当今互联网技术日新月异的时代,实时流媒体传输已经成为在线视频分享、直播、远程教育等应用场景不可或缺的一部分。Nginx,作为一款高性能的HTTP和反向代理服务器,...
在 Linux 系统上升级 Nginx 版本 Nginx 是一个流行的开源 Web 服务器软件,可以运行在多种操作系统上,其中包括 Linux。随着 Nginx 的不断更新和发展,升级 Nginx 版本成为一个不可避免的问题。本文将指导您在 ...