确实是人数一多就这样卡住了
但是配配是 2 核 4G 3M 的
不应该是带宽问题
因为 1 分钟最大同时在线才 18 人就卡住了
下面是我的配置参数,刚从网上看了教程改的
不知道还有需要优化或有错的地方不?
centos7.5 python3.6 django2.2
ps: 在卡住的那个时间点我看了一下日志
还有少少百度蜘蛛来网站!难道这个也有关系?
uwsgi.conf
```
# myweb_uwsgi.ini file
[uwsgi]
#django-related settings
socket = 127.0.0.1:8001
# the base directory (full path)
chdir = /var/www/website
# Django s wsgi file
module = website.wsgi:application
env = DJANGO_SETTINGS_MODULE = website.settings
daemonize = /var/log/nginx/website_access.log;
# process-related settings
# master
master = true
py-autoreload = 1
# maximum number of worker processes
processes = 4
threads = 2
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
```
nginx.conf
```
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 20000;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
client_header_buffer_size 4k;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 443;
server_name
website.com;
ssl on;
ssl_certificate 1_www.website.com_bundle.crt;
ssl_certificate_key 2_www.website.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
charset UTF-8;
access_log /var/log/nginx/website_access.log;
error_log /var/log/nginx/website_error.log;
client_max_body_size 75M;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 128k;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8001;
uwsgi_send_timeout 300;
uwsgi_connect_timeout 300;
uwsgi_read_timeout 300;
}
location /static {
expires 30d;
autoindex on;
#return 403;
add_header Cache-Control private;
alias /var/wwwr/website/static/;
}
location /media {
expires 30d;
autoindex on;
#return 403;
add_header Cache-Control private;
alias /var/wwwr/website/media/;
}
}
```