# Define the number of nginx processes run by the user and User Group WWW; # Set 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 Ar/logstores/error. log Info; # process file PID Ar/runner-up. PID; # the maximum number of file descriptors opened by an nginx process. The theoretical value should be the maximum number of opened files (the system value ulimit-N, however, nginx allocation requests are uneven, so we recommend that you keep them consistent with the ulimit-N value. Worker_rlimit_nofile 65535; # working mode and maximum number of connections events {# refer to the event model, use [kqueue | rtsig | epoll |/dev/poll | select | poll]; the epoll model is a high-performance network I/O model in the kernel of Linux 2.6 or later versions. If you are running on FreeBSD, use the kqueue model. Use epoll; # maximum number of connections (maximum number of connections = number of connections * Number of processes) worker_connections 65535;} # Set HTTP Server HTTP {include mime. types; # default_type application/octet-stream; # default file type # charset UTF-8; # server_names_hash_bucket_size 128; # client_header_buffer_size 32 K for the hash table of the server name; # the size of the uploaded file is limited to large_client_header_buffers 4 64 K; # Set client_max_body_size 8 m for request easing; # Set sendfile on; # enable the efficient file transmission mode. The sendfile command specifies whether nginx calls the sendfile function to output files, For general applications that are set to on, if used for downloading and other application disk I/O heavy load applications, you can set it to off to balance the disk and network I/O processing speed and reduce the system load. Note: If the image is not displayed properly, change it to off. Autoindex on; # enable directory list access, which is suitable for downloading servers. It is disabled by default. Tcp_nopush on; # prevent network congestion tcp_nodelay on; # prevent network congestion keepalive_timeout 120; # long connection timeout time, in seconds # FastCGI-related parameters are used to improve website performance: reduces resource usage and increases access speed. The following parameters can be understood literally. Fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64 K; fastcgi_buffers 4 64 K; Limit 128 K; Limit 128 K; # gzip module setting gzip on; # enable gzip compression output gzip_min_length 1 K; # minimum compressed file size gzip_buffers 4 16 K; # compressed buffer gzip_http_version 1.0; # compressed version (1.1 by default, use 1.0 for the front-end squid2.5) gzip_comp_level 2; # compression grade gzip_types text/plain application/X-JavaScript t EXT/CSS application/XML; # The compression type. textml is already included by default, so you don't need to write it again. There will be no problem if you write it, but there will be a warn. Gzip_vary on; # limit_zone crawler $ binary_remote_addr 10 m; # Use upstream blog.ha97.com {# upstream for Load Balancing when limiting IP connections. weight is the weight and the weight can be defined based on machine configuration. The weigth parameter indicates the weight. A higher weight indicates a higher 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;} # configure Server for the VM {# Listen to port listen 80; # multiple domain names can be 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 ;}# set the image cache time location ~. *. (GIF | JPG | JPEG | PNG | BMP | SWF) $ {expires 10d;} # JS and CSS cache time settings location ~. *. (JS | CSS )? $ {Expires 1 h ;} # Set the log format to log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request" ''$ Status $ response" $ http_referer "'' "$ http_user_agent" $ http_x_forwarded_for '; # define the access log access_log Ar/logstores/ha97access for this VM. log Access; # enable reverse proxy location/{proxy_pass http: // 127.0.0.1: 88; proxy_redirect off; proxy_set_header X-real-IP $ remote_addr; # The backend web server can use X-forwarded-for to obtain the user's real ipproxy_set_he Ader X-forwarded-for $ proxy_add_x_forwarded_for; # The following are some reverse proxy configurations, which are optional. Proxy_set_header host $ host; client_max_body_size 10 m; # maximum number of single-file bytes allowed for client requests client_body_buffer_size 128 K; # maximum number of bytes cached by the buffer proxy client request, proxy_connect_timeout 90; # nginx and backend server connection timeout (proxy connection timeout) proxy_send_timeout 90; # backend server data return time (proxy sending timeout) proxy_read_timeout 90; # after successful connection, response time of the backend server (proxy receiving timeout) proxy_buffer_size 4 K; # Set the buffer size proxy_buffers 4 32 K for the proxy server (nginx) to save user header information; # proxy_buffers buffer, set proxy_busy_buffers_size 64 K on average for Web pages below 32 K; # buffer under high load Size (proxy_buffers * 2) proxy_temp_file_write_size 64 K; # sets the cache folder size. If it is greater than this value, it will be uploaded from the upstream server} # sets the address location/nginxstatus {stub_status on for viewing nginx status; access_log on; auth_basic "nginxstatus"; auth_basic_user_file confpasswd; # the content of the htpasswd file can be generated using the htpasswd tool provided by Apache .} # Reverse proxy configuration for local dynamic/static separation # 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 $ scheme; proxy_pass http: // 127.0.0.1: 8080 ;} # All static files are directly read by nginx without passing through tomcat or resinlocation ~. *. (HTM | HTML | GIF | JPG | JPEG | PNG | BMP | SWF | IOC | RAR | zip | TXT | FLV | mid | Doc | PPT | PDF | XLS | MP3 | WMA) $ {expires 15d;} location ~. *. (JS | CSS )? For more information about the module parameters, see http://wiki.nginx.org/mainat: http://www.2cto.com/ OS /201212/176520.html.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.