阿里云服务器nginx多tomcat跳转配置
2015-04-25 17:17
375 查看
配置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; <strong> //配置跳转服务器,这里的cms.cn,client.cn等等要和server{ }里面的server_name cms.cn ,client.cn等等相对应</strong> upstream cms.cn{ server 127.0.0.1:8085; } upstream client.cn{ server 127.0.0.1:8086; } upstream driver.cn{ server 127.0.0.1:8083; } upstream franchisee.cn{ server 127.0.0.1:8085; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; <strong>//这里可以配置nginx默认目录默认是安装目录下html目录</strong> location / { # root html; root /opt/www; index index.html index.htm; } } server { listen 80; server_name cms.cn; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://cms.cn; } #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; } } server { listen 80; server_name client.cn; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://client.cn; } #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; } } server { listen 80; server_name driver.cn; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://driver.cn; } #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; } } server { listen 80; server_name franchisee.cn; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://franchisee.cn; } #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; } } # 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; # } #} }
相关文章推荐
- 配置(Linux、JDK、Tomcat、nginx)阿里云ecs服务器
- 阿里云服务器ESC使用配置tomcat和nginx
- Nginx+Tomcat+Https 服务器负载均衡配置
- 阿里云服务器配置java生产环境jdk1.7+tomcat7.0+mysql5.5(二)
- 阿里云服务器ECS Apache、Nginx 配置支持跨域访问
- 配置阿里云服务器教程(安全组,连接服务器,jdk+tomcat+mysql)
- 服务器使用Tomcat配置server.xml文件通过域名直接跳转到项目
- 阿里云配置nginx+php+mysql+ftp 服务器环境(亲测过程)
- 图文:CentOS 下对 Nginx + Tomcat 配置 SSL 实现服务器 / 客户端双向认证
- 阿里云CentOS7.0服务器配置(java+mariadb+tomcat+svn+ftp)
- [原]阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- 阿里云 > 教程中心 > java教程 > 详细的图文教程来实现 eclipse环境下如何配置tomcat,并且把项目部署到Tomcat服务器上 详细的图文教程来实现 eclipse
- 解决IE apk变成zip:Android 手机应用程序文件下载服务器Nginx+Tomcat配置解决方法
- CentOS系统安装配置Nginx+tomcat+jdk+MySQL服务器环境
- CentOS 下对 Nginx + Tomcat 配置 SSL 实现服务器 / 客户端双向认证
- 配置搭建阿里云服务器nginx+uwsgi (python)
- 阿里云服务器nginx下如何添加伪静态以及配置静态资源地址
- Django学习笔记四:阿里云服务器购买和配置nginx
- 在阿里云、微软Windows Azure、亚马逊AWS 上使用Nginx配置http正向代理服务器
- [原]阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)