博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx+tomcat 动静分离 的配置文件
阅读量:6962 次
发布时间:2019-06-27

本文共 4326 字,大约阅读时间需要 14 分钟。

安装忽略了。以下是nginx的配置文件。 记得修改目录权限为nginx。

user  nginx nginx;worker_processes auto;error_log    /var/log/nginx/error.log      crit;pid           /var/run/nginx.pid;worker_rlimit_nofile 51200;events    {        use epoll;        worker_connections 51200;        multi_accept on;    }http    {        include       mime.types;        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"';        server_names_hash_bucket_size 128;        client_header_buffer_size 32k;        large_client_header_buffers 4 32k;        client_max_body_size 50m;        sendfile   on;        tcp_nopush on;        keepalive_timeout 60;        tcp_nodelay on;        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 256k;        gzip on;        gzip_min_length  1k;        gzip_buffers     4 16k;        gzip_http_version 1.1;        gzip_comp_level 2;        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;        gzip_vary on;        gzip_proxied   expired no-cache no-store private auth;        gzip_disable   "MSIE [1-6]\.";        #limit_conn_zone $binary_remote_addr zone=perip:10m;  容器共使用10M的内存来对于IP传输开销        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. 每个IP使用10个连接,添加在location 里面        server_tokens off;        access_log off;server    {        listen 80 default_server;        #listen [::]:80 default_server ipv6only=on;        server_name  localhost;        location / {            root /usr/local/tomcat/webapps/ROOT;            index  index.htm index.html index.jsp;        }        location ~ \.(jsp|jspx|do)?$ {            index index.jsp;            proxy_pass http://192.168.10.51:8080;  #来自jsp请求交给tomcat处理            proxy_redirect off;            proxy_set_header Host $host;  #后端的Web服务器可以通过X-Forwarded-For获取用户真实IP            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 128k; #缓冲区代理缓冲用户端请求的最大字节数            proxy_connect_timeout 90;  #nginx跟后端服务器连接超时时间(代理连接超时)            proxy_read_timeout 90;   #连接成功后,后端服务器响应时间(代理接收超时)            proxy_buffer_size 4k;    #设置代理服务器(nginx)保存用户头信息的缓冲区大小            proxy_buffers 6 32k;    #proxy_buffers缓冲区,网页平均在32k以下的话,这样设置            proxy_busy_buffers_size 64k;#高负荷下缓冲大小(proxy_buffers*2)            proxy_temp_file_write_size 64k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传        }        location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {            root  /usr/local/tomcat/webapps/ROOT;            expires 1d;        }        location ~ ^/(WEB-INF)/ {            deny all;          }        error_page   404   /404.html;        ##PHP        # Deny access to PHP files in specific directory        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }        # location ~ \.php$ {
# root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # include fastcgi_params; # } #location ~ [^/]\.php(/|$) #{
# try_files $uri =404; # fastcgi_pass unix:/tmp/php-cgi.sock; # fastcgi_index index.php; # include fastcgi.conf; #} # location /nginx_status # {
# stub_status on; # access_log off; # } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /var/log/nginx/access.log; }}
本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/2046293,如需转载请自行联系原作者
你可能感兴趣的文章
kloxo增加了域名,怎么不能访问?如何重启web服务?
查看>>
Nginx调试入门
查看>>
Centos7安装jdk
查看>>
MySQL锁
查看>>
国学题库整理
查看>>
jquery chosen 插件 动态设置+更新选项值
查看>>
求最大值及其下标
查看>>
战力会议1
查看>>
水印情缘。。。
查看>>
为什么重写equals一定要重写hashCode?
查看>>
HDU Problem 4006 The kth great number 【队列】
查看>>
win8阉割版中文输入法
查看>>
Codeforces VK Cup 2015 A.And Yet Another Bracket Sequence(后缀数组+平衡树+字符串)
查看>>
以Drools5.5为例说明“规则引擎在业务系统中应用”---起始篇
查看>>
linux清理内存
查看>>
查看硬盘负载情况:iostat命令
查看>>
《人月神话》阅读笔记03
查看>>
Linux下防火墙开启相关端口及查看已开启端口
查看>>
学习笔记之CloudCompare
查看>>
UEditor 与Struts2 结合上传图片
查看>>