#设定访问的默认首页地址
#user nobody;
#启动进程数
worker_processes 8;
#进程cpu分配
#worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
#worker_rlimit_nofile 102400;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#工作模式及连接数上限
events {
#use epoll; #for linux2.6+
worker_connections 102400;
#multi_accept on;
}
#设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
include mime.types;
default_type application/octet-stream;
#charset utf-8;
#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;
sendfile on;
#tcp_nopush on;
keepalive_timeout 60;
#fastcgi_connect_timeout 300;
#fastcgi_send_timeout 300;
#fastcgi_read_timeout 300;
#fastcgi_buffer_size 64k;
#fastcgi_buffers 4 64k;
#fastcgi_busy_buffers_size 128k;
#fastcgi_temp_file_write_size 128k;
#client_max_body_size 10m;
#client_body_buffer_size 256k;
#cache
#proxy_connect_timeout 5;
#proxy_read_timeout 60;
#proxy_send_timeout 5;
#proxy_buffer_size 16k;
#proxy_buffers 4 64k;
#proxy_busy_buffers_size 128k;
#proxy_temp_file_write_size 128k;
#proxy_temp_path /home/temp_dir;
#proxy_cache_path /home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
#open_file_cache max=1024 inactive=20s;
#open_file_cache_valid 30s;
#open_file_cache_min_uses 1;
#gzip on;
#gzip_min_length 1k;
#gzip_buffers 4 16k;
#gzip_http_version 1.0;
#gzip_comp_level 2;
#gzip_types text/plain application/x-javascript text/css application/xml;
#gzip_vary on;
upstream tomcats {
#server 192.168.3.6:9090 weight=1;
#server 192.168.3.121:9090 weight=1;
server 192.168.3.223:9090 weight=5 max_fails=2 fail_timeout=600s;
server 192.168.3.224:9090 weight=5 max_fails=2 fail_timeout=600s;
}
#禁止通过ip访问站点
#server{
# server_name _;
# return 404;
#}
server {
listen 80;
server_name localhost:9090;
#设定访问的默认首页
#index index.html index.htm index.jsp;
#设定网站的资源存放路径
#root /home/www/web/ROOT;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcats;
#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;
#client_max_body_size 10m;
#client_body_buffer_size 256k;
#proxy_connect_timeout 15;
#proxy_send_timeout 15;
#proxy_read_timeout 15;
}
#设定访问静态文件直接读取不经过tomcat
#location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
#{
# expires 30d;
#}
#location ~ .*\.(js|css)?$
#{
# expires 1h;
#}
#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;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
- 浏览: 19295 次
- 性别:
- 来自: 成都
相关推荐
网络上很难找到非常详细的关于nginx配置https的全流程,大多都是一小段,要么缺A要么缺B。 本文档通过真实的实践经验,从安装OpenSSL和Nginx,到利用openssl生成证书,配置nginx的https(包括配置http请求转发到...
Nginx配置文件 nginx.conf 详解doc文档
nginx配置+https
Nginx配置多个service 多个访问路径 找到conf/nginx.conf修改配置文件 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid ...
nginx配置 +负载均衡+https协议 完整的配置以及nginx 启动 停止 重新加载
windows下 php+nginx配置详解,经整理修改测试通过,希望和大家一起分享!
nginx配置 nginx配置文件参考 nginx配置文件参考
主要介绍了Nginx配置SSL自签名证书的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
liunx nodejs+nginx配置收藏版liunx nodejs+nginx配置收藏版
nginx 配置跨域不生效 如下配置 server { listen 80; server_name localhost; # 接口转发 location /api/ { # 允许请求地址跨域 * 做为通配符 add_header 'Access-Control-Allow-Origin' '*'; # 设置请求...
Windows下Nginx配置SSL实现Https访问(包含证书生成)
Nginx配置ThinkPHP框架 ...............
nginx配置图片服务器
nginx配置多个conf。nginx.conf和conf.d,
Nginx配置文件——一级域名、二级域名
squid和nginx配置正向代理访问API接口
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户 user www-data; #启动进程,通常设置成和cpu的数量相等 worker_processes 1; #全局错误日志及PID文件 error_log /var/log/...
对nginx进行详细的访问数量,日志请求头配置,多域名分发,反向代理等配置,可以对手机访问进行判断重定向手机域名
Nginx 配置说明文档,方便管理和配置,在测试工作中很重要,可以优化测试,达到最优配置策略,方便管理,方便运营,方便配置安装。
基于docker容器的nginx配置文件,包含反向代理和负载均衡配置,具体使用和操作可以参见我的博客 nginx docker下搭建环境和配置文章