In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
# define the users and user groups under which Nginx is running
User www www
# number of nginx processes. It is recommended to set it to equal to the total number of CPU cores.
Worker_processes 8
# Global error log definition type, [debug | info | notice | warn | error | crit]
Error_log / var/log/nginx/error.log info
# process files
Pid / var/run/nginx.pid
# the maximum number of file descriptors opened by a nginx process. The theoretical value should be the maximum number of open files (system value ulimit-n) divided by the number of nginx processes, but the nginx allocation request is not uniform, so it is recommended to be consistent with the value of ulimit-n.
Worker_rlimit_nofile 65535
# working mode and upper limit of connections
Events
{
# refer to the event model, use [kqueue | rtsig | epoll | / dev/poll | select | poll]. The epoll model is a high-performance network Icano model in the kernel of Linux version 2.6. if it runs on FreeBSD, use the kqueue model.
Use epoll
# maximum number of connections per process (maximum number of connections = number of connections * number of processes)
Worker_connections 65535
}
# configure http server
Http
{
Include mime.types; # File extension and File Type Mapping Table
Default_type application/octet-stream; # default file type
# charset utf-8; # default Encoding
Server_names_hash_bucket_size 128; # hash table size of the server name
Client_header_buffer_size 32k; # upload file size limit
Large_client_header_buffers 4 64k; # set request delay
Client_max_body_size 8m; # set request delay
Sendfile on; # enables efficient file transfer mode. The sendfile instruction specifies whether nginx calls the sendfile function to output files. For common applications, set it to on. If it is used for downloading and other application disk IO heavy-load applications, it can be set to off to balance the processing speed of disk and network Ibano and reduce the load of the system. Note: if the picture does not display properly, change this to off.
Autoindex on; # enables directory list access, which is suitable for download server. It is disabled by default.
Tcp_nopush on; # prevent network congestion
Tcp_nodelay on; # prevent network congestion
Keepalive_timeout 120; # persistent connection timeout (in seconds)
# FastCGI-related parameters are designed to improve the performance of the website: reduce resource consumption and improve access speed. The following parameters can be understood literally.
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 module settings
Gzip on; # enable gzip compressed output
Gzip_min_length 1k; # minimum compressed file size
Gzip_buffers 4 16k; # compressed buffer
Gzip_http_version 1.0; # compressed version (default 1.1, use 1.0 if the front end is squid2.5)
Gzip_comp_level 2; # Compression level
Gzip_types text/plain application/x-javascript text/css application/xml
# the compression type already contains text/html by default, so you don't have to write it any more, and there will be no problem writing it, but there will be a warn.
Gzip_vary on
# limit_zone crawler $binary_remote_addr 10m; # you need to use it to limit the number of IP connections
Upstream blog.ha97.com {
# upstream load balancer. Weight is the weight, which can be defined according to the machine configuration. The weigth parameter represents the weight, and the higher the weight, the greater the probability of being assigned.
Server 192.168.80.121:80 weight=3
Server 192.168.80.122:80 weight=2
Server 192.168.80.123:80 weight=3
}
# configuration of virtual host
Server
{
# listening port
Listen 80
# there can be multiple domain names, separated by spaces
Server_name www.ha97.com ha97.com
Index index.html index.htm index.php
Root / data/www/ha97
Location. *\. (php | php5)? $
{
Fastcgi_pass 127.0.0.1:9000
Fastcgi_index index.php
Include fastcgi.conf
}
# Image caching time setting
Location ~. *\. (gif | jpg | jpeg | png | bmp | swf) $
{
Expires 10d
}
# JS and CSS cache time settings
Location. *\. (js | css)? $
{
Expires 1h
}
# Log format setting
Log_format access'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent" $http_x_forwarded_for'
# define the access log of this virtual host
Access_log / var/log/nginx/ha97access.log access
# enable reverse proxy for "/"
Location / {
Proxy_pass http://127.0.0.1:88;
Proxy_redirect off
Proxy_set_header X-Real-IP $remote_addr
# backend Web servers can obtain users' real IP through X-Forwarded-For
Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
# the following are some configuration of reverse proxies, optional.
Proxy_set_header Host $host
Client_max_body_size 10m; # the maximum number of bytes per file that the client is allowed to request
Client_body_buffer_size 128k; # buffer proxy buffers maximum number of bytes requested by the client
Proxy_connect_timeout 90; # nginx connection timeout with backend server (proxy connection timeout)
Proxy_send_timeout 90; # backend server data return time (proxy send timeout)
Proxy_read_timeout 90; # response time of back-end server after successful connection (proxy received timeout)
Proxy_buffer_size 4k; # sets the buffer size of the proxy server (nginx) for storing account information
Proxy_buffers 4 32k; # proxy_buffers buffer, settings with an average of less than 32k for web pages
Proxy_busy_buffers_size 64k; # buffer size under high load (proxy_buffers*2)
Proxy_temp_file_write_size 64k
# set the cache folder size. If it is larger than this value, it will be transferred from the upstream server.
}
# set the address to view the status of Nginx
Location / NginxStatus {
Stub_status on
Access_log on
Auth_basic "NginxStatus"
Auth_basic_user_file conf/htpasswd
The contents of the # htpasswd file can be generated using the htpasswd tool provided by apache.
}
# Local static and dynamic separation reverse proxy configuration
# all jsp pages are handled by tomcat or resin
Location. (jsp | jspx | do)? ${
Proxy_set_header Host $host
Proxy_set_header X-Real-IP $remote_addr
Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
Proxy_pass http://127.0.0.1:8080;
}
# all static files are read directly by nginx without going through tomcat or resin
Location ~. *. (htm | html | gif | jpg | jpeg | png | bmp | ioc | rar | zip | txt | flv | mid | doc | ppt | pdf | xls | mp3 | wma) $
{expires 15d;}
Location. *. (js | css)? $
{expires 1h;}
}
}
Reprint address http://www.ha97.com/5194.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.