记录在windows 2003 上配置Ningx 1.2.3。
1.下载Ningx,解压至F:/server/
2.同时配置两个tomcat实例,位于F:/server/tomcat-1和F:/server/tomcat-2
端口需要处理,不要冲突。
3.修改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 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 main;
sendfile on;
#tcp_nopush on;
#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;
index index.html index.htm;
proxy_pass http://127.0.0.1;
}
error_page 404 /40x.html;
location = /40x.html {
root 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;
#}
}
upstream 127.0.0.1 {
server 127.0.0.1:8082 weight=1;
server 127.0.0.1:8083 weight=2;
}
# 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;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
4.nginx命令:
start eginx
nginx -s stop quick exit
nginx -s quit graceful quit
nginx -s reload changing configuration, starting a new worker, quitting gracefully an old worker
nginx -s reopen reopening log files
分享到:
相关推荐
Windows+Nginx+Tomcat做负载均衡同时实现session共享Demo
Windows+Nginx+Tomcat做负载均衡同时实现session共享Demo
很好的学习Windows+Nginx+Tomcat搭建负载均衡和集群环境教材,里面有详细的Demo。
tomcat+nginx+Redis集成demo tomcat+nginx+Redis集成demotomcat+nginx+Redis集成demo
1.搭建一个最简洁,模块划分最明确的ssm+swargger+shiro+redis+nginx整合项目,采用maven作为构建工具,在有新项目开发时可以借助此demo快速构建项目 2.实现shiro的授权信息缓存到redis数据库,减少关系数据库...
做Tomcat集群的目的是为了提供更高的负载能力,把访问均摊到不同的服务器上。当有访问请求时nignx会随机将访问请求分发到tomcat1,tomcat2,为了...我们配置的环境是:win7,JDK1.7,nginx-1.8,tomcat6 2个,memcached
nginx_tomcat8_redis负载均衡demo
nginx+tomcat集群demo,已测试,可放心下载使用!包含 nainx最新包。 温馨提示此demo是windows环境测试。 启动nginx:start nginx或nginx.exe。 关闭nginx:nginx.exe -s stop或nginx.exe -s quit。 访问方式:...
详细教程:http://blog.csdn.net/ifwinds/article/details/52164530 包含以下内容: Tomcat:apache-tomcat-7.0.57.tar Nginx:pcre-8.34.tar ,nginx-1.6.2.tar Ftp:vsftpd-2.2.2-6.el6_0.1.x86_64.rpm
Nginx+tomcat 实现负载均衡session共享demo,和http://blog.csdn.net/u014513883/article/details/48550709 类似
windows环境下Nginx(1.15.10)+Tomcat(7.0.93)搭建高性能负载均衡集群,快速部署.txt文档,启动tomcat和Nginx就行,有完整的demo可以直接运行,有测试访问地址localhost:8888/test/
包含代码,俩个tomcat,一个redis,还有一个Nginx,全部都是配置好的。
nginx+redis负载均衡、session共享,基于redis+tomcat实现session同步的简单demo
我一篇博文关于跨域访问前端的demo,主要就是为了说明,ajax请求,需要加上参数crossDomain: true, 和xhrFields: {withCredentials: true}, 以实现cookie的会话跟踪 ...
博主使用Tomcat+Redis+Nginx实现的一个简单的Tomcat集群demo,包含Nginx和Tomcat配置
个人demo,nginx配置2个tomcat,2个域名,2个端口,用nginx反应代理统一访问控制。双击nginx.exe启动,然后启动2个tomcat,前提是本地host配置好2个域名。
一个nginx和tomcat负载的例子,附上实现(已测试),用共享的方式实现session共享
Tomcat在高并发环境下处理动态请求时性能很低,而在处理静态页面更加脆弱。是通过Nginx来处理静态页面要比通过Tomcat处理在性能方面好很多。本例为nginx负载均衡配置方法
完整版demo奉上
之前对于使用域名如何访问项目很好奇,但苦于搞一个自己的域名实在是太麻烦了,还需要去买,各种...然后开始正式操作,先随便搭个项目,能访问就行,通过tomcat启动,输入http://localhost:8080/demo/login/index.do