QQ登录 - 设为首页 - 加入收藏 - 网站地图 木易瓶子屋!第一时间了解互联网开发技术新鲜事儿!

亲!来点一下试试嘛。。。

木易瓶子屋每日新鲜技术平台 第一时间了解互联网的那些事儿

nginx1.0+resin4配置简单的反向代理

作者:木易瓶子┆ 分类:服务器技术┆时间:2015-01-13┆点击: 108次┆tags: nginx1.0+resin4配置反向代理

1、nginx.cnf:

[plain] view plaincopy
  1. #user  nobody;  
  2. worker_processes  1;  
  3.   
  4. #error_log  logs/error.log;  
  5. #error_log  logs/error.log  notice;  
  6. #error_log  logs/error.log  info;  
  7.   
  8. #pid        logs/nginx.pid;  
  9.   
  10.   
  11. events {  
  12.     worker_connections  1024;  
  13. }  
  14.   
  15.   
  16. http {  
  17.     include       mime.types;  
  18.     default_type  application/octet-stream;  
  19.   
  20.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  21.     #                  '$status $body_bytes_sent "$http_referer" '  
  22.     #                  '"$http_user_agent" "$http_x_forwarded_for"';  
  23.   
  24.     #access_log  logs/access.log  main;  
  25.   
  26.     sendfile        on;  
  27.     #tcp_nopush     on;  
  28.   
  29.     #keepalive_timeout  0;  
  30.     keepalive_timeout  65;  
  31.   
  32.     gzip  on;  
  33.     upstream resinserver {  
  34.     server 127.0.0.1:888 weight=1;  
  35.     server 127.0.0.1:999 weight=1;  
  36.     }  
  37.     server {  
  38.         listen       9092;  
  39.         server_name  localhost;  
  40.   
  41.         #charset koi8-r;  
  42.   
  43.         #access_log  logs/host.access.log  main;  
  44.   
  45.         location / {  
  46.             #root   html;  
  47.             #index  index.html index.htm;  
  48.             proxy_pass http://resinserver ;  
  49.             proxy_redirect    off;  
  50.             proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;  
  51.             proxy_set_header  X-Real-IP  $remote_addr;  
  52.             proxy_set_header  Host $http_host;  
  53.         }  
  54.   
  55.         #error_page  404              /404.html;  
  56.   
  57.         # redirect server error pages to the static page /50x.html  
  58.         #  
  59.         error_page   500 502 503 504  /50x.html;  
  60.         location = /50x.html {  
  61.             root   html;  
  62.         }  
  63.   
  64.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80  
  65.         #  
  66.         #location ~ \.php$ {  
  67.         #    proxy_pass   http://127.0.0.1;  
  68.         #}  
  69.   
  70.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
  71.         #  
  72.         #location ~ \.php$ {  
  73.         #    root           html;  
  74.         #    fastcgi_pass   127.0.0.1:9000;  
  75.         #    fastcgi_index  index.php;  
  76.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  
  77.         #    include        fastcgi_params;  
  78.         #}  
  79.   
  80.         # deny access to .htaccess files, if Apache's document root  
  81.         # concurs with nginx's one  
  82.         #  
  83.         #location ~ /\.ht {  
  84.         #    deny  all;  
  85.         #}  
  86.     }  
  87.   
  88.   
  89.     # another virtual host using mix of IP-, name-, and port-based configuration  
  90.     #  
  91.     #server {  
  92.     #    listen       8000;  
  93.     #    listen       somename:8080;  
  94.     #    server_name  somename  alias  another.alias;  
  95.   
  96.     #    location / {  
  97.     #        root   html;  
  98.     #        index  index.html index.htm;  
  99.     #    }  
  100.     #}  
  101.   
  102.   
  103.     # HTTPS server  
  104.     #  
  105.     #server {  
  106.     #    listen       443;  
  107.     #    server_name  localhost;  
  108.   
  109.     #    ssl                  on;  
  110.     #    ssl_certificate      cert.pem;  
  111.     #    ssl_certificate_key  cert.key;  
  112.   
  113.     #    ssl_session_timeout  5m;  
  114.   
  115.     #    ssl_protocols  SSLv2 SSLv3 TLSv1;  
  116.     #    ssl_ciphers  HIGH:!aNULL:!MD5;  
  117.     #    ssl_prefer_server_ciphers   on;  
  118.   
  119.     #    location / {  
  120.     #        root   html;  
  121.     #        index  index.html index.htm;  
  122.     #    }  
  123.     #}  
  124.   
  125. }  
2、resin.xml:
[html] view plaincopy
  1. <cluster id="app-tier1">  
  2.           
  3.         <root-directory>.root-directory>  
  4.       
  5.           
  6.         <server-default>  
  7.           
  8.           
  9.         <span style="color:#FF0000;"><http address="*" port="888"/>span>  
  10.          <load-balance-idle-time>120sload-balance-idle-time>  
  11.         <jvm-arg>-Xms1024mjvm-arg>  
  12.     <jvm-arg>-Xmx1024mjvm-arg>  
  13.     <jvm-arg>-Xmn256mjvm-arg>  
  14.     <jvm-arg>-Xrsjvm-arg>  
  15.     <jvm-arg>-XX:PermSize=256mjvm-arg>  
  16.     <jvm-arg>-XX:MaxPermSize=512mjvm-arg>  
  17.         <thread-max>25000thread-max>  
  18.         <socket-timeout>180ssocket-timeout>  
  19.         <keepalive-max>1024keepalive-max>  
  20.         <keepalive-timeout>180skeepalive-timeout>  
  21.         server-default>  
  22.           
  23.         <server id="sync-server" address="127.0.0.1" port="6804">  
  24.         server>  
  25.       
  26.       
  27.           
  28.         <host id="" root-directory=".">  
  29.             
  30.         <root-directory>.root-directory>  
  31.       
  32.           
  33.         <server-default>        
  34.           
  35.         <span style="color:#FF0000;"><http address="*" port="999"/>span>  
  36.          <load-balance-idle-time>120sload-balance-idle-time>  
  37.         <jvm-arg>-Xms1024mjvm-arg>  
  38.     <jvm-arg>-Xmx1024mjvm-arg>  
  39.     <jvm-arg>-Xmn256mjvm-arg>  
  40.     <jvm-arg>-Xrsjvm-arg>  
  41.     <jvm-arg>-XX:PermSize=256mjvm-arg>  
  42.     <jvm-arg>-XX:MaxPermSize=512mjvm-arg>  
  43.         <thread-max>25000thread-max>  
  44.         <socket-timeout>180ssocket-timeout>  
  45.         <keepalive-max>1024keepalive-max>  
  46.         <keepalive-timeout>180skeepalive-timeout>  
  47.         server-default>  
  48.           
  49.         <server id="sync-server-1" address="127.0.0.1" port="6808">  
  50.         server>  
  51.       
  52.       
  53.           
  54.         <host id="" root-directory=".">  
  55.           
欢迎转载但请注明出处及链接,商业媒体使用请联系编辑(QQ 363630845)。
nginx1.0+resin4,配置,反向代理
正在加载中……