1024programmer Nginx Use Nginx to reverse proxy weblogic

Use Nginx to reverse proxy weblogic

I have been using apache as the front end of weblogic before, but due to the excellent performance of nginx for static content, I have to switch to nginx. Not here
Then write the installation of weblogic.

install nginx
nginx needs pcre for support, and the general system comes with it. Of course, you can download a higher version of the source package and install it yourself. It is recommended that you use a higher version of pcre.
In this way, there will be better support when using regular expressions.
First go to http://wiki.nginx.org//NginxChs to download nginx, I used 0.7

# tar zxvf nginx-0.7.59.tar.gz
# cd nginx-0.7.59
# ./configure –with-http_stub_status_module ?prefix=/opt/nginx
# make
# make install

–with-http_stub_status_module Add nginx monitoring module to monitor Nginx
current state of .

Let’s configure nginx
Configuration file, nginx.conf under /opt/nginx/conf, to save trouble, directly copy my configuration file:
#user nobody;
worker_processes 10;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
use
epoll; //The way nginx handles connections, epoll
– Efficient method for Linux kernel version 2.6 and later systems.
worker_connections 51200;
}

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 75;

#gzip on;

upstream 99ding {
server
124.42.*.***:7002 weight=10;
server
124.42.*.***:7001 weight=10;
}
//Because my weblogic is not clustered, I can only use the load balancing that comes with nginx, but It is recommended to use the cluster of weblogic

server {
listen 80;
server_name www.server110.com;

#charset
koi8-r;

#access_log logs/host.access.log main;

location
~ ^/status/ {
stub_status
on;
access_log
off;
}
//Monitor the status of nginx: http://www.test.com/status/

location
/ {
  root /opt/html/app;
index index.html
index.htm;
expires
30d; //expires is to set the survival time of COOKIE, I used it for 30 days
}

location
~ ^/(WEB-INF)/ {
deny
all;
}

location
~
\.(htm|html|gif|jpg|jpeg|png|bmp|ico|rar|css|js|zip|txt|flv|swf|mid|doc|ppt|xls|pdf|txt|mp3|wma)$
{
root
/opt/html/app;
expires
24h;
}

location
~ (\.jsp)|(\.do) {
proxy_pass http://test;
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
proxy_buffer_size
4k;
proxy_buffers
4 32k;
proxy_busy_buffers_size
64k;
proxy_temp_file_write_size
64k;
proxy_max_temp_file_size
512m;
}
//The most critical place is to transfer the jsp and do files to weblogic for processing, here is the test created above (the name of the load balancer), if not

For load balancing, you can replace test with “ip:port number”, for example http://10.0.0.1:7001

#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;
}

}

}

Next, just start the service, first check whether there is any error in the configuration file:
/opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf
Start the service:
/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf

opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf
Start the service:
/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/use-nginx-to-reverse-proxy-weblogic/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索