# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent ' ' $request_time $upstream_response_time '; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; client_max_body_size 20m; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; # server { # listen 80 default_server; # listen [::]:80 default_server; # server_name _; # root /usr/share/nginx/html; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # error_page 404 /404.html; # location = /40x.html { # } # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # } # Settings for a TLS enabled server. upstream api{ server 127.0.0.1:8080; } upstream websocket{ server 127.0.0.1:8089; } server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name _; root /usr/share/nginx/html; ssl_certificate "/etc/nginx/key/test.pem"; ssl_certificate_key "/etc/nginx/key/test.key"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; rewrite /a.txt /api/a.txt break; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } location /api { proxy_pass http://api; # 后端的Web服务器可以通过X-Forwarded-For获取用户真实IP 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_http_version 1.1; proxy_cookie_path /api/ /; } location /websocket { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }
相关推荐
反向代理及Nginx示例,需要配饰ngnix反向代理的朋友可以看看
nginx示例代码以及中文配置详解
技术分享:反向代理及Nginx示例
带有搜索引擎友好 URL 的 Kayako nginx 示例 - 这已经通过在 CentOS 7 和 nginx/1.6.3 上运行的 Kayako 4.73.3 进行了测试 nginx配置包括: Gzip压缩 安全配置 关闭对隐藏文件和敏感上下文的访问 XSS 配置以强制...
具有搜索引擎友好URL的MailWizz nginx示例-已在具有Nginx / 1.6.3的CentOS 7上运行的MailWizz 1.3.6.x上进行了测试Nginx配置包括: SSL和非SSL配置PHP FPM 支持跟踪域带有SSL装订和调整功能的SSL配置Gzip压缩安全...
nginx多域名配置示例 php多级域名配置 二级域名配置示例 nginx伪静态示例
nginx lua示例代码,基于open resty,参考http://www.iteye.com/blogs/subjects/nginx-lua
本文是关于 nginx rewrite常用示例。
nginx配置示例SSL
python-nginx, 在 python 中,创建和修改 Nginx serverblock配置 python 用于在 python ( 包含评论) 中轻松创建和修改 Nginx serverblock配置的模块。安装pip install python-nginx示例创建 Nginx serverb
docker nginx静态网站示例,docker Dockerfile方式build docker镜像,启动nginx容器
提供了小程序https服务在nginx环境下的配置示例,包括https配置和小程序扫二维码打开小程序时需要在nginx服务端放置小程序二维码扫描校验文件的配置
nginx 配置ssl 示例
#Nginx带有后备基本身份验证的客户端证书身份验证这是带有以下内容的nginx配置的示例: 转发HTTP到https 保护对子目录的访问通过客户证书进行认证当证书不可用时回退到基本身份验证(用户和密码) 有关创建客户端...
nginx示例配置,想怎么使用nginx加速你的web应用吗,想知道怎么配置nginx达到你的目的吗。。示例配置
主要介绍了nginx部署多个vue项目的方法示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
Nginx 配置文件,示例
Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамб...
windows环境下nginx init脚本示例 包含启动及关闭示例
nginx作为图片服务器示例,超级性能,比网上的示例都强大,支持大批量http图片访问