Nginx(发音同 engine x)是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,是目前市面上唯一能和kangleweb server比拼的web server,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:新浪、网易、腾讯等。
Nginx 的一个参考配置配置文件:
#user nobody; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } 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"'; access_log logs/access.log; sendfile on; #tcp_nopush on; upstream 127.0.0.1 { #根据ip计算将请求分配各那个后端tomcat,许多人误认为可以解决session问题,其实并不能。 #同一机器在多网情况下,路由切换,ip可能不同 #ip_hash; #weigth参数表示权值,权值越高被分配到的几率越大 server 127.0.0.1:8088 weight=1; } #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost;#这是浏览器中访问的路径 #charset koi8-r; #access_log logs/host.access.log main; location / { #root html\www; root D:\\Workspaces\\cpzghtml; index index.jsp index.html index.htm main.action; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ ###所以的静态文件人gif、jpg等都在本地打开,存放的目录为/usr/local/nginx/html,保存时间为30天 { root D:\\Workspaces\\cpzghtml; ##这是一个动静页面分开的项目这里是静态项目路径 expires 30d; } location ~ (\.jsp)|(\.action)|(\.cl)$ { #匹配以jsp结尾的,tomcat的网页文件是以jsp结尾 index index.jsp; proxy_pass http://127.0.0.1; #主要在这里,设置一个代理 } #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; # } #} }
相关推荐
这个是pdf文档,讲授nginx和tomcat整合的方法!
linux下Nginx+tomcat整合的安装与配置
关于nginx和tomcat在window下的下载安装和使用等。仅供参考。
nginx和tomcat整合.pdf
nginx整合tomcat 1、准备软件(存放在目录/home/sofeware下) agentzh-headers-more-nginx-module-v0.15rc2-0-g2c629de.tar.gz #支持隐藏头部信息 (不是必须,觉得需要就安装吧) nginx-upstream-jvm-route-0.1.tar....
Nginx和tomcat上传文件大小限制修改,Ngnix和tomcat默认对上传文件大小有限制。
windows下nginx+tomcat负载整合完整实例
技术分享:linux下Nginx+tomcat整合的安装与配置 目的:搭建 Nginx 与 tomcat 整合,用 Nginx 代替 apache
Nginx+tomcat+redis软负载均衡需要的一整套资源,还包括了JDK,依赖包等文件
nginx-tomcat整合实现JAVA程序负载均衡
Nginx+tomcat配置集群负载均衡实现动静分离实例
nginx和tomcat配置SSL和负载均衡配置,
nginx和tomcat的整合.pdf
自己做的一个nginx+tomcat+redis完成session共享小例子,包括所需jar,适合初学者,希望大家一起学习交流
linux下安装nginx和tomcat。
nginx+tomcat集群配置文件
linux下Nginx+tomcat整合的安装与配置.pdf
nginx_tomcat8_redis负载均衡demo