In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares to you is about the steps of running and starting in the Nginx configuration. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
There are a lot of things we don't understand when we configure Nginx. In fact, sometimes we can find more ways to solve problems as long as we change our way of thinking. Next we will give you a detailed introduction to the relevant information about the configuration of Nginx.
# run user user nobody nobody; # start process worker_processes 2; # Global error log and PID document error_log logs/error.log notice; pid logs/Nginx.pid; # working mode and upper limit of connections events {use epoll; worker_connections 1024;} # set http server, use his reverse proxy function to provide load balancing support http {# set mime type include conf/mime.types Default_type application/octet-stream; # set the log format log_format main'$remote_addr-$remote_user [$time_local]'"$request" $status $bytes_sent''"$http_referer"$http_user_agent"'"$gzip_ratio"' Log_format download'$remote_addr-$remote_user [$time_local]'"$request" $status $bytes_sent''"$http_referer", $http_user_agent "'" $http_range "" $sent_http_content_range "; # set request buffer client_header_buffer_size 1k; large_client_header_buffers 44k; # Open gzip module gzip on; gzip_min_length 1100; gzip_buffers 48k Gzip_types text/plain; output_buffers 1 32k; postpone_output 1460; # set access log access_log logs/access.log main; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65 # set the server list of load balancer upstream mysvr {# weigth parameter indicates the weight, the higher the weight, the greater the probability of being assigned # the Squid on the local machine opens port 3128 server 192.168.8.1 weight=5; server 3128 weight=5; server 192.168.2 weight=5; server 80 weight=1; server 192.168.8.3 upstream mysvr 80} # configure the virtual host server {listen 80 Server_name 192.168.8.1 www.yejr.com; charset gb2312; # sets the access log access_log logs/www.yejr.com.access.log main of this virtual host # if you visit the / img/*, / js/*, / css/* resource, fetch the local documents directly, not through squid # if there are more of these documents, this method is not recommended, because the caching effect through squid is better location ~ ^ / (img | js) / {root / data3/Html; expires 24h;} # enable load balancing location / {proxy_pass http://mysvr; for "/" Proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k } # set the address location / NginxStatus {stub_status on; access_log on; auth_basic "NginxStatus"; auth_basic_user_file conf/htpasswd;} to view the Nginx status
Note: the content of the conf/htpasswd document can be generated using the htpasswd tool provided by apache, and the content is roughly as follows:
3.) View the running status of Nginx and enter the address http://192.168.8.1/NginxStatus/. Enter the verification account password and you can see something similar to the following:
Active connections: 328 server accepts handled requests 9309 8982 28890 Reading: 1 Writing: 3 Waiting: 324
The first line represents the number of connections that are now active, and the third number in the third line indicates that the Nginx is running to.
These are the steps to run and start in the Nginx configuration, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.