In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what the nginx configuration file is like. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
# run the user
User www-data
# start the process, usually set to equal the number of cpu
Worker_processes 1
# Global error log and PID file
Error_log / var/log/nginx/error.log
Pid / var/run/nginx.pid
# working mode and upper limit of connections
Events {
Use epoll; # epoll is a way of multiplexing IO (I _ Multiplexing O Multiplexing), but only for kernels above linux2.6, it can greatly improve the performance of nginx.
Worker_connections 1024 cross # maximum number of concurrent links for a single background worker process process
# multi_accept on
}
# configure the http server and use its reverse proxy function to provide load balancing support
Http {
# set the mime type, which is defined by the mime.type file
Include / etc/nginx/mime.types
Default_type application/octet-stream
# set log format
Access_log / var/log/nginx/access.log
# sendfile directive specifies whether nginx calls the sendfile function (zero copy mode) to output the file, for common applications
# must be set to on. If it is used for downloading and other application disk IO heavy-loaded applications, it can be set to off to balance the processing speed of disk and network Imax O and reduce the uptime of the system.
Sendfile on
# tcp_nopush on
# connection timeout
# keepalive_timeout 0
Keepalive_timeout 65
Tcp_nodelay on
# enable gzip compression
Gzip on
Gzip_disable "MSIE [1-6]\. (?!. * SV1)"
# set request buffer
Client_header_buffer_size 1k
Large_client_header_buffers 4 4k
Include / etc/nginx/conf.d/*.conf
Include / etc/nginx/sites-enabled/*
# set the list of servers for load balancer
Upstream mysvr {
# weigth parameter indicates the weight. The higher the weight, the greater the probability of being assigned.
# Squid on this machine opens port 3128
Server 192.168.8.1:3128 weight=5
Server 192.168.8.2:80 weight=1
Server 192.168.8.3:80 weight=6
}
Server {
# listening on port 80
Listen 80
# define access using www.xx.com
Server_name www.xx.com
# set the access log of this virtual host
Access_log logs/www.xx.com.access.log main
# default request
Location / {
Root / root; # defines the default site root location for the server
Index index.php index.html index.htm; # defines the name of the home index file
Fastcgi_pass www.xx.com
Fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name
Include / etc/nginx/fastcgi_params
}
# define error prompt page
Error_page 500 502 503 504 / 50x.html
Location = / 50x.html {
Root / root
}
# static files, handled by nginx itself
Location ~ ^ / (images | javascript | js | css | flash | media | static) / {
Root / var/www/virtual/htdocs
# 30 days after expiration, static files are not updated very often. Expiration can be set to a larger size, or smaller if updated frequently.
Expires 30d
}
# PHP script requests are all forwarded to FastCGI for processing. Use the default configuration of FastCGI.
Location ~\ .php$ {
Root / root
Fastcgi_pass 127.0.0.1:9000
Fastcgi_index index.php
Fastcgi_param SCRIPT_FILENAME / home/www/www$fastcgi_script_name
Include fastcgi_params
}
# 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
}
# prohibit access to .htxxx files
Location ~ /\ .ht {
Deny all
}
}
}
This is the end of this article on "what the nginx configuration file is like". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.