1024programmer Nginx Detailed explanation of the installation and configuration process of Nginx+tomcat service under Linux system

Detailed explanation of the installation and configuration process of Nginx+tomcat service under Linux system

#The user name and user group where nginx is running
#user www www;
#Start the number of processes
worker_processes 8;
#Global error log and PID file
error_log /usr/local/nginx/logs/nginx_error.log
crit;
pid
/usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be
opened by this process.
worker_rlimit_nofile 65535;
#Working mode and connection limit
events
{
use epoll;
worker_connections 65535;
}
#Set up the http server, use its reverse proxy function to provide load balancing support
http
{
#Set mime type
include
mime.types;
default_type application/octet-stream;
include /usr/local/nginx/conf/proxy.conf;
#charset gb2312;
#Set request buffer
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
# fastcgi_connect_timeout 300;
# fastcgi_send_timeout 300;
# fastcgi_read_timeout 300;
# fastcgi_buffer_size 64k;
# fastcgi_buffers 4 64k;
# fastcgi_busy_buffers_size 128k;
# fastcgi_temp_file_write_size 128k;
# gzip on;
# gzip_min_length 1k;
# gzip_buffers 4 16k;
# gzip_http_version 1.0;
# gzip_comp_level 2;
# gzip_types
text/plain application/x-Javascript text/css application/xml;
# gzip_vary on;
#limit_zone crawler
$binary_remote_addr 10m;
###Forbid access to the site through ip
server{
server_name
_;
return 404;
}
server
{
listen
80;
server_name localhost;
index index.html index.htm
index.jsp;#Set the default home page address
root
/home/www/web/ROOT;#Set the resource storage path of the website
#limit_conn crawler
20;
location ~ .*.jsp$
#All jsp pages are handled by tomcat
{
index index.jsp;
proxy_pass
http://localhost:8080;# Turn to tomcat processing
}
location ~
.*\.(gif|jpg|jpeg|png|bmp|swf)$ #Set access static files to read directly without going through tomcat
{
expires
30d;
}
location ~ .*\.(js|css)?$
{
expires
1h;
}
#Define the writing format of the access log
` log_format access`
‘$remote_addr – $remote_user [$time_local] “$request”‘
‘$status
$body_bytes_sent “$http_referer”‘
‘”$http_user_agent”
$http_x_forwarded_for’;
access_log
/usr/local/nginx/logs/localhost.log access;#Set the storage path of access logs
} }
}

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/detailed-explanation-of-the-installation-and-configuration-process-of-nginxtomcat-service-under-linux-system/

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
首页
微信
电话
搜索