Nginx中配置文件gzip问题

/etc/init.d/ngnix start之后弹出
Starting nginx daemon;nginx:[emerg] unknown directive"gzip_static" in /usr/local/nginx/conf/nginx.conf:52
怎么解决啊

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
nginx 配置文件里server_name为_是什么意思?
这个东西真不是很明白,别人都说这个是来反向代理的,可是怎么体现的,还有这个配置文件,是怎么样一个操作过程能讲下么,真的不明白,知道的非常零散, # Default server configuration # server { listen 80 default_server;//这个是默认监听端口号 80 可是谁监听谁,nginx监听电脑上的80端口么 listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; //这个好像是我如果写一个静态网页可以在这个路径下写然后在环回地址显示,,具体是什么不明白求解释 # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html;//不明白 就是一堆html文件 server_name _;//也不明白 别人说配的域名 location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; }//普通定位 但是也不明白 nginx去定位什么, # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php7.0-cgi alone: #fastcgi_pass 127.0.0.1:9000; # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.0-fpm.sock; } //正则匹配如果后缀是php网页就进行php解析么, # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } 请稍微详细解释下,非常感谢大佬们啦,,,,,
阿里云+nginx+ssl+https配置后,网页依旧无法显示,请大神指教
阿里云+nginx+ssl配置后,网页依旧无法显示,请大神指教 域名已经解析 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581225059_616698.png) 服务器相关端口已打开 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581231238_906425.png) 系统是unbuntu16,nginx版本为1.15,已有ssl模块 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581225248_962076.png) ssl证书有上传至服务器 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581225321_579997.png) nginx的配置文件nginx.conf内容如下 ``` #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # server { # listen 80; # server_name localhost; # #charset koi8-r; # #access_log logs/host.access.log main; # location / { # root html; # index index.html index.htm; # } # #error_page 404 /404.html; # # redirect server error pages to the static page /50x.html # # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # root html; # } # # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # # # #location ~ \.php$ { # # proxy_pass http://127.0.0.1; # #} # # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # # # #location ~ \.php$ { # # root html; # # fastcgi_pass 127.0.0.1:9000; # # fastcgi_index index.php; # # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # # include fastcgi_params; # #} # # deny access to .htaccess files, if Apache's document root # # concurs with nginx's one # # # #location ~ /\.ht { # # deny all; # #} # } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # server { listen 443 ssl; server_name www.faceanalyze.club faceanalyze.club; ssl_certificate /usr/local/nginx/cert/cert.pem; ssl_certificate_key /usr/local/nginx/cert/cert.key; # ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } } server { listen 80; server_name www.faceanalyze.club faceanalyze.club; return 301 https://$server_name$request_uri; } } ``` nginx有重新加载配置,端口使用情况如下 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581225719_742816.png) 用浏览器查看时,无法显示 ![图片说明](https://img-ask.csdn.net/upload/202002/09/1581225832_412617.png) 请大神求解!谢谢
已安装的Nginx追加自带模块始终报错
* Centos7系统下已安装的nginx需要追加http_limit_req_module模块。按照网上的方法,下载了对应版本的源码, 1. 在配置参数后追加--with-http_limit_req_module,出现以下报错 ``` ./configure: error: invalid option "--with-http_limit_req_module" ``` 2. 使用--add-module=http_limit_req_module报找不到config文件 ``` adding module in http_limit_req_module ./configure: error: no http_limit_req_module/config was found ``` 3. 将模块名改成ngx_http_limit_req_module报的也是类似的错误 # 求大神看看应该怎么添加 下面是完整配置参数,nginx版本是1.17.8,--with-http_limit_req_module前的参数是用nginx -V查出来的 ``` ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --with-http_limit_req_module ```
Nginx配置404页面无效
主要的相关配置: ``` http { include mime.types; default_type application/octet-stream; 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # fastcgi_intercept_errors on | off; # 启用自定义错误页面 fastcgi_intercept_errors on; server { listen 80; server_name localhost; charset utf8; access_log logs/80-access.log main; error_log logs/80-error.log error; location / { root html; index index.html index.htm; } # 使用腾讯公益404页面 error_page 404 /404.html; location = /404.html { root html; } # error_page 404 = http://www.test.com/error.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } ``` 注:404.html和50x.html都在html文件夹下,404页面无效,还是默认的界面如下: ![file](http://bucket836.oss-cn-shenzhen.aliyuncs.com/image-1575883353106.png)
nginx配置文件要怎么配才能访问,现在访问页面404
我用的是TOMCAT+nginx,端口也是80,现在用ajax跳转到主页出现了404问题。防火墙也关了。帮我看看是不是配置文件错了 ``` user root; #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } ```
nginx+php部署关于nginx.conf配置问题,请教熟悉的朋友
我使用的lnmp包安装的,安装提示成功。也能正常访问phpinfo页面。 把自己项目放上去后,更改了php.ini的doc_root 改为项目地址;然后就是nginx改成以下: user root; worker_processes auto; error_log /home/wwwlogs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept on; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; 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 256k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; #limit_conn_zone $binary_remote_addr zone=perip:10m; ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. server_tokens off; #log format log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; access_log off; upstream OfficeFPM { server 127.0.0.1:8266 weight=1; keepalive 100; } server { listen 81 default_server; server_name localhost; index index.html index.php; root /home/wwwroot/default; #error_page 404 /404.html; include enable-php.conf; if (-d $request_filename){rewrite ^/(.*)([^/])$ $scheme://$http_host/$1$2/ permanent; } #charset gbk; #access_log logs/host.access.log main; location ~* ^/(attachment|static|images|theme|templates|wav)/.*\.(php|.php3|.php5|jsp|asp)$ { deny all; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:8266 # location ~ \.php$ { fastcgi_pass OfficeFPM; fastcgi_index index.php; include fastcgi.conf; } location /general/document/index.php/ { fastcgi_pass OfficeFPM; fastcgi_index index.php; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME /home/wwwroot/default/general/document/index.php; fastcgi_param SCRIPT_NAME /general/document/index.php; fastcgi_split_path_info ^(.+\.php)/(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; } location /general/itask/router.php/ { fastcgi_pass OfficeFPM; fastcgi_index index.php; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME /home/wwwroot/default/general/itask/router.php; fastcgi_param SCRIPT_NAME /general/itask/router.php; } location ~* ^/attachment/(background|im|new_sms|reportshop|cache|data_center) { allow all; } location ~* ^/attachment { deny all; } location ~ /\. { deny all; } location / { if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } access_log /home/wwwlogs/access.log access; } include vhost/*.conf; } 当时访问出现如下图错误,index.php报错 ![图片说明](https://img-ask.csdn.net/upload/201603/06/1457263996_477379.png) 当我改成静态页面时候却能正常访问,请教了,本人第一次搞这个对这些配置文件很模糊,请高手帮忙改下。
nginx配置同一应用三个tomcat,都能登录,但是访问不了其他页面,但是关闭两个后,页面就能访问
问题描述: 利用Nginx配置一个应用的三个tomcat负载均衡。(具体见Nginx配置文件), 配置后能登陆进系统, ![图片说明](https://img-ask.csdn.net/upload/201908/09/1565318479_819064.jpg) 刷新该页面的时候三个TOMCAT都有连接输入日志。 但是点击任意一个菜单的时候,提示404错误,见图: ![图片说明](https://img-ask.csdn.net/upload/201908/09/1565318596_362609.jpg),Nginx没有_任何报错日志。_ 如果把tomcat_任意关掉两个_,只剩下一个(Nginx没有关闭),那么点击菜单的时候可以打开。 以下是Nginx配置文件: ``` worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; keepalive_timeout 65; gzip on; gzip_http_version 1.1; gzip_comp_level 2; gzip_min_length 1k; #最小压缩大小 gzip_buffers 4 16k; #压缩缓冲区 upstream serverlist{ server localhost:8081 weight=1; server localhost:8082 weight=1; server localhost:8083 weight=1; } server { listen 80; server_name welcome; location /welcomeTest { proxy_pass http://serverlist; proxy_set_header Host $http_host; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Cookie $http_cookie; client_max_body_size 50m; client_body_buffer_size 256k; proxy_connect_timeout 30; proxy_send_timeout 30; proxy_read_timeout 60; proxy_buffer_size 256k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_temp_file_write_size 256k; proxy_next_upstream error timeout invalid_header http_500 http_503 http_404; proxy_max_temp_file_size 128m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|css|js|ico)$ { proxy_pass http://serverlist; } 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://serverlist; } } } ``` 请问如何解决这个问题,是配置不全 还是需要在其他页面加入东西吗?
nginx 负载均衡这样设置配置文件对吗?如何测试负载均衡?
user nobody nobody; worker_processes 3; pid logs/nginx.pid; events { worker_connections 1024; use epoll; } http { include mime.types; default_type application/octet-stream; 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 logs/access.log main; sendfile on; keepalive_timeout 65; gzip on; gzip_min_length 1024; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #gunzip_static on; upstream backend { server 192.168.1.30:8081; server 192.168.1.31:8081; server 192.168.1.32:8081; } server { listen 8081; server_name 192.168.1.30; error_page 404 /404.html; location / { root myweb; index index.30.htm; } location /server0/location1 { root myweb; index index.svr0-loc1.htm; } location /svr0/loc2 { alias myweb/server0/location2/; index index.svr0-loc2.htm; } } server { listen 8081; server_name 192.168.1.31; error_page 404 /404.html; location / { root myweb; index index.31.htm; } location /server1/location1 { root myweb; index index.svr1-loc1.htm; } location /svr1/loc2 { alias myweb/server1/location2/; index index.svr1-loc2.htm; } } server { listen 8081; server_name 192.168.1.32; error_page 404 /404.html; location / { root myweb; index index.32.htm; } location /server2/location1 { root myweb; index index.svr2-loc1.htm; } location /svr2/loc2 { alias myweb/server2/location2/; index index.svr2-loc2.htm; } } server { listen 8081; server_name myserver; #index index.html index.htm; location / { proxy_pass http://backend; proxy_set_header Host $host; } } }
为何django admin 静态文件一直加载不上去
user root; worker_processes auto; #pid /run/nginx.pid; events { worker_connections 768; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; #access_log/var/log/nginx/access.log; #error_log/var/log/nginx/error.log; gzip on; gzip_disable "msie6"; server { listen 80; server_name 47.103.45.202; charset utf-8; location / { uwsgi_pass 127.0.0.1:8000; include /usr/local/nginx/conf/uwsgi_params; uwsgi_param UWSGI_CHDIR /data/mywork/mywork; uwsgi_param UWSGI_SCRIPT mywork.wsgi; } location /static/ { alias /data/mywork/static/; } } } ``` [uwsgi] chdir = /data/mywork #ip =0.0.0.0 #port=8000 module= mywork.wsgi:application #home= /data/env/pyweb #workers=%k processes = 4 threads=2 #http=%(d):%(port) wsgi-file = mywork/wsgi.py socket=127.0.0.1:8000 master = true pidfile=uwsgi.pid enabled-threads=true vacuum = true daemonize = /data/mywork/mywork/run.log disable-logging = true #virtualenv = /data/evn/pyweb/lib/python3.6/ static-map=/static=/data/mywork/static ``` ``` ```按照网上的方法修改setting.by, 然后先收集静态文件 修改nginx静态文件配置路径,重启nginx 重启uwsgi 还是不行,不知道原因出在哪里 求高人指点
nginx静态资源无法完全加载的问题
我目前碰到的问题具体是这样的: 1. 若不开启静态资源压缩,则所有静态资源都无法加载。 2. 开启静态资源压缩后,部分静态资源可以访问,当某个超过40KB左右的JS文件无法访问时,其后续的静态资源都无法加载,各种浏览器试了都是同样的现象。 以上都是在Windows1809系统下,没有任何后端,纯前端静态。 nginx设置了MB级别的请求大小限制,绝对够KB级的静态资源访问用了,也设置了各种超时时长以及缓存,静态资源文件的访问权限也是有的,同时我查看了nginx本身的日志,所有请求的状态码都是200,并没有任何异常或报错,就浏览器那端报4XX或5XX。 此情况只出现在我本机上,局域网下其他机器访问我本机的nginx服务与资源都是完全正常的,而且我把同样的nginx配置和资源挪到其他机器跑起来然后自访问也是完全正常的,所以这个就很诡异了。 我个人怀疑可能是Windows防火墙、Defender杀毒软件、某一次系统更新,因为去年这些都是正常的,不太记得是哪一次系统升级或更新之后就出现这种情况了。 如果实在没办法了我只好重装系统来解决了 贴一下nginx主配置: ``` http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #on/off #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 300s 300s; fastcgi_connect_timeout 6000s; fastcgi_send_timeout 6000s; fastcgi_read_timeout 6000s; fastcgi_buffer_size 256k; fastcgi_buffers 8 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; # 压缩配置 gzip on; #开启gzip压缩功能,默认是关闭的。 gzip_static on; #开启gzip静态资源 gzip_min_length 1k; #允许压缩的页面最小字节数,默认是全部都压缩,最好不要小于1k,因为小于1k的可能越压越大。 gzip_buffers 16 128k; #设置系统获取几个单位的缓存用于存储gzip的压缩结果数据流。4 16k代表以16k为单位,安装原始数据大小以16k为单位的4倍申请内存。 gzip_http_version 1.1; #设置http协议版本,只对1.1版本进行压缩。 gzip_comp_level 9; #gzip压缩比/压缩级别,压缩级别 1-9,级别越高压缩率越大,当然压缩时间也就越长(传输快但比较消耗cpu)。 gzip_types text/plain text/xml text/css text/javascript application/xml application/json application/javascript application/x-javascript image/x-icon image/jpg image/jpeg image/gif image/png application/x-font-ttf application/font-woff application/font-woff2; #设置压缩文件类型,这里指定了text/html text html js css json xml image font。 gzip_disable "MSIE [1-6]\."; #IE1-6版本不支持gzip压缩 gzip_proxied any; gzip_vary off; #给http请求增加vary字段,不支持gzip的不进行压缩处理。 # 设置上传文件大小限制 client_max_body_size 50M; client_body_buffer_size 512K; client_header_buffer_size 10M; client_header_timeout 120s; client_body_timeout 120s; # http_proxy proxy_buffers 32 256k; #缓冲区,nginx针对单个连接缓存来自后端real-server的响应 proxy_buffer_size 256k; #设置代理服务器(nginx)从后端real-server读取并保存用户头信息的缓冲区大小,默认与proxy_buffers大小相同,其实可以将这个指令值设的小一点 proxy_busy_buffers_size 256k; #高负荷下缓冲大小(proxy_buffers*2) proxy_max_temp_file_size 1024M; #当proxy_buffers放不下后端服务器的响应内容时,会将一部分保存到硬盘的临时文件中,这个值用来设置最大临时文件大小,默认1024M,它与proxy_cache没有关系。大于这个值,将从upstream服务器传回。设置为0禁用。 proxy_temp_file_write_size 256k; #当缓存被代理的服务器响应到临时文件时,这个选项限制每次写临时文件的大小。 proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; upstream nacos-server { server 127.0.0.1:8848; #server 127.0.0.1:8841; #server 127.0.0.1:8842; #server 127.0.0.1:8843; } include ../servers/*.conf; } ``` --- 某一个次配置: ``` server { # 设置端口监听 listen 80; # 设置监听的域名(此处的域名为自定义配置,请在host文件中添加) server_name nacos.cn; # 统一字符编码 charset utf-8; # 资源根路径 root static; #access_log logs/host.access.log main; # 默认配置 #location / { # index login.html; #} # 端口转发配置 location /nacos/ { proxy_pass http://nacos-server/nacos/; add_header From nacos.cn; proxy_redirect default; proxy_set_header Host $host; proxy_set_header Server-Name $server_name; proxy_set_header Http-Host $http_host; proxy_set_header Cookie $http_cookie; proxy_set_header Referer $http_referer; proxy_set_header Nginx_Version $nginx_version; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-Port $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Nginx-Proxy true; proxy_cookie_path / /; } # 异常处理 #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; } ```
求助:nginx反向代理tomcat集群问题
1.我在Vmvare中安装了centos7,并且在centos7中安装了tomcat并在防火墙中开放了访问端口,windows中用浏览器可以正常访问看到黄猫的界面,centos7内部自带的火狐浏览器不能访问,显示链接被重置。求助,可能的原因是什么啊? 2、同时我在centos7中部署了nginx反向代理tomcat集群,部署了两台tomcat,并且能够分别正常访问。我在nginx.conf中添加了代理配置,但是通过nginx服务器访问我的项目显示404,查看日志显示请求的路径是nginx安装目录下的html/test,test是我的项目,这是不是说明我的nginx服务器根本没有去tomcat中请求服务,我的请求到nginx中就终止了,他直接到自己的html目录下面查找我的项目,因为没有我的项目,所以报错,为什么会这样啊?(能确保nginx服务器安装无误,gcc等依赖编译包都正确安装,nginx.conf中的配置也确保正确,求助,还会有什么原因导致这种情况) (以上两个问题都是在公司内网环境下,通过代理上网的) 这两个问题困扰我好几天了,希望能够得到广大猿友们帮助QAQ nginx.conf配置文件: #user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream tomcat_server{ server 127.0.0.1:8090; server 127.0.0.1:8000; server 127.0.0.1:8081; server 127.0.0.1:8082; ip_hash; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; proxy_pass http://tomcat_server; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } nginx日志: 1 2018/02/08 12:10:40 [error] 12057#0: *11 open() "/usr/local/nginx/html/test" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /test HTTP/1.1", host: "192.168.200.131" 2 2018/02/08 12:31:47 [error] 12057#0: *15 open() "/usr/local/nginx/html/test" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /test HTTP/1.1", host: "192.168.200.131" 3 2018/02/08 12:31:47 [error] 12057#0: *15 open() "/usr/local/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.200.131" 4 2018/02/08 12:40:13 [error] 12057#0: *17 open() "/usr/local/nginx/html/test" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /test HTTP/1.1", host: "192.168.200.131" 5 2018/02/11 10:05:04 [notice] 2863#0: signal process started 6 2018/02/11 10:05:16 [error] 2864#0: *1 open() "/usr/local/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.200.131", referrer: "http://192.168.200.131/" 7 2018/02/11 10:05:21 [error] 2864#0: *3 open() "/usr/local/nginx/html/test" failed (2: No such file or directory), client: 192.168.200.11, server: localhost, request: "GET /test HTTP/1.1", host: "192.168.200.131"
如何将java Web项目设置 nginx反向代理
操作系统 : cent Os 7 虚拟机上用tomcat跑了一个web项目,端口8001 虚拟机IP:192.168.168.144 在主机上可以通过 192.168.168.144:8001/web访问该项目。 请教如何配置nginx , 可以实现在 主机上 通过 www.mywebtest.com访问到该web项目? 呃,自己搞了半天。nginx都启不起来。。 配置文件如下: user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; 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; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; server{ listen 192.168.168.144:8001; server_name www.mywebtest.com; location / { root web; } } }
Nginx + Tomcat 反向代理,配置失败,求大神解惑!
前提: 二级域名:www.hnrunzhi.com,admin.hnrunzhi.com http service:Nginx web service:Tomcat 服务器:Linux 目的:通过Nginx反向代理实现 多个二级域名访问 linux服务器上tomcat上的web项目。 例如:www.hnrunzhi.com 通过Nginx反向代理访问 a项目 www.hnrunzhi.com 通过Nginx反向代理访问 b项目 Nginx的nginx.conf文件如下: ``` #设置低权限用户,为了安全而设置的 #user nobody; #工作衍生进程数 worker_processes 4; #设置错误文件存放路径 #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #设置pid存放路径(pid是控制系统中重要文件) #pid logs/nginx.pid; #设置最大连接数 events{ worker_connections 1024; } 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 /data/wwwlogs/access_nginx.log main; #开启高效文件传输模式 sendfile on; #防止网络阻塞 tcp_nopush on; #防止网络阻塞 tcp_nodelay on; #长连接超时时间,单位是秒 keepalive_timeout 65; #散列表的冲突率,默认1024,越大则内存消耗更多,但散列key的冲突率会降低,检索速度就更快 types_hash_max_size 2048; #文件扩展名与文件类型映射表 include /usr/local/nginx/conf/mime.types; #默认文件类型 default_type application/octet-stream; #include /etc/nginx/conf.d/*.conf; #主要是用于设置一组可以在proxy_pass和fastcgi_pass指令中使用额代理服务器,默认负载均衡方式为轮询 upstream tomcat_client { server localhost:8080; } #开启gzip压缩,开启后,访问网页会自动压缩 #gzip on; #指定服务器的名称和参数 server { listen 80; server_name www.hnrunzhi.com; location / { proxy_pass http://tomcat_client; proxy_redirect default; #设置代理 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } server { listen 80; server_name admin.hnrunzhi.com; location / { proxy_pass http://tomcat_client; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } } ``` Tomcat的service.xml文件如下: ``` <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="utf-8"/> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="www.hnrunzhi.com"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="www.hnrunzhi.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="/" docBase="/usr/java/apache-tomcat-7.0.79/webapps/Education" reloadable="true"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="www_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> <Host name="admin.hnrunzhi.com" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="/" docBase="/usr/java/apache-tomcat-7.0.79/webapps/RunZhi.M.S" reloadable="true"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="admin_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> </Engine> </Service> ``` 结果: 通过http://www.hnrunzhi.com/ 可以正常访问到Education项目,而http://admin.hnrunzhi.com 报404,需要 http://admin.hnrunzhi.com/RunZhi.M.S/ 这样才能访问 请大牛帮帮忙,瞧瞧看,我哪个地方配置的是不是有问题咯? 谢谢!~~~
nginx1.8+tomcat8配置不成功
按照以下文件配置之后,单独访问localhost:8080没有问题,但是访问localhost就还是nginx的欢迎页面,没有转到tomcat页面 nginx.conf文件; ``` #user root; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 2048; } http { include mime.types; default_type application/octet-stream; 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream tomcats{ server 127.0.0.1:8080; } server { listen 80; server_name tomcats; #charset koi8-r; access_log logs/host.access.log main; location / { proxy_pass http://tomcats; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} #if (-d $request_filename) #{ # rewrite ^/(.*)([^/])$http://$host/$1$2/ permanent; #} location ~ \.(jsp|jspx|do|action|wsdl)?$ { # proxy_set_header Host $host; # proxy_set_header X-Forwarded-For $remote_addr; proxy_connect_timeout 3; proxy_send_timeout 30; proxy_read_timeout 30; proxy_pass http://tomcat_server; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } ``` server.xml文件: ``` <?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL/TLS HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 This connector uses the NIO implementation that requires the JSSE style configuration. When using the APR/native implementation, the OpenSSL style configuration is required as described in the APR/native documentation --> <!-- <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost"> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> </Engine> </Service> </Server> ```
nginx配置了WebSocket 谷歌浏览器会报404.
用域名访问项目没问题,用域名访问项目WebSocket功能谷歌浏览器就报 WebSocket connection to 'ws://sodb.qdairport.com/qdsodb/websocket/admin' failed: Error during WebSocket handshake: Unexpected response code: 404 用ip加端口访问项目WebSocket功能可以正常连接上 nginx配置文件 #user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #设置允许上传内容大小 client_max_body_size 200M; client_body_buffer_size 128k; gzip on; #配置域名和ip upstream sodb.qdairport.com { server 10.48.1.16:8080 weight=1; #权重为1 server 10.48.1.17:8080 weight=1; #权重为2 } server { listen 80; server_name sodb.qdairport.com; location / { proxy_pass http://sodb.qdairport.com; 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_connect_timeout 3; proxy_read_timeout 3600; proxy_send_timeout 60; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } } ``` ```
Linx nginx 文件服务器报404,求大神帮忙看下
![图片说明](https://img-ask.csdn.net/upload/201712/19/1513677746_181428.png) 本来想要实现这种效果 ![图片说明](https://img-ask.csdn.net/upload/201712/19/1513677934_888203.png) nginx.conf配置文件如下 ``` [root@localhost conf]# vi nginx.conf #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/conf.d/*.conf; include mime.types; default_type application/octet-stream; #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 logs/access.log main; client_header_buffer_size 100M; autoindex on; autoindex_exact_size on; autoindex_localtime on; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8088; server_name localhost; root /home/files/; #charset koi8-r; #access_log logs/host.access.log main; location ~ .*.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { expires 15d; } location ~ .*\.(gif|jpg|pocx|poc|xls|xlsx|mp4|jpeg|png)$ { expires 24h; root /home/files/; access_log /home/nginx/logs/images.log; proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /home/files/; proxy_redirect off; proxy_set_header Host 127.0.0.1; 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 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1:8088; } } location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } ```
并发1000左右,数据优化
Linux服务器:64G内存、320G硬盘、20M带宽;nginx、PHP、MySQL MySQL数据量在1亿左右。现在并发是10000,宝塔后台负载状态一直都是100%,业务处理/数据访问比较多【数据库增删改查频繁】。服务器运行一段时间之后MySQL崩溃了,重启MySQL之后,命令链接mysql -uroot -p 输入密码后需要很久才能连接到数据库,有时还会卡死导致无法连接数据库。 nginx配置图 ``` user www www; worker_processes auto; error_log /www/wwwlogs/nginx_error.log crit; pid /www/server/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept on; } http { include mime.types; #include luawaf.conf; include proxy.conf; default_type application/octet-stream; server_names_hash_bucket_size 512; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 100; 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 256k; fastcgi_intercept_errors on; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_name zone=perserver:10m; server_tokens off; access_log off; ``` MySQL配置文件 ``` #password = your_password port = 3306 socket = /mysql_log/mysql.sock [mysqld] binlog_cache_size = 256K thread_stack = 512K join_buffer_size = 8192K query_cache_type = 0 max_heap_table_size = 2048M port = 3306 socket = /mysql_log/mysql.sock datadir = /www/server/data default_storage_engine = InnoDB performance_schema_max_table_instances = 400 table_definition_cache = 400 skip-external-locking key_buffer_size = 1024M max_allowed_packet = 100G table_open_cache = 2048 sort_buffer_size = 4096K net_buffer_length = 4K read_buffer_size = 4096K read_rnd_buffer_size = 2048K myisam_sort_buffer_size = 256M thread_cache_size = 256 query_cache_size = 0M tmp_table_size = 2048M sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES explicit_defaults_for_timestamp = true #skip-name-resolve max_connections = 500 max_connect_errors = 100 open_files_limit = 65535 wait_timeout=100 interactive_timeout=100 #log-bin=mysql-bin #binlog_format=mixed server-id = 1 expire_logs_days = 1 slow_query_log=1 slow-query-log-file=/www/server/data/mysql-slow.log long_query_time=3 #log_queries_not_using_indexes=on early-plugin-load = "" innodb_data_home_dir = /www/server/data innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /www/server/data innodb_buffer_pool_size = 4096M innodb_log_file_size = 2048M innodb_log_buffer_size = 0M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 innodb_max_dirty_pages_pct = 90 innodb_read_io_threads = 32 innodb_write_io_threads = 32 [mysqldump] quick max_allowed_packet = 500M [mysql] no-auto-rehash [myisamchk] key_buffer_size = 1024M sort_buffer_size = 16M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] #interactive-timeout ```
nginx无法启动,报错各位大神看一下
nginx改了配置文件后启动不起来了 http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 443 ssl ; server_name www.1haoshopping.cn; ssl_certificate /home/Nginx/1_www.1haoshopping.cn_bundle.crt; ssl_certificate_key /home/Nginx/2_www.1haoshopping.cn.key; ssl_session_timeout 5000m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; add_header Content-Security-Policy upgrade-insecure-requests; if ( $scheme = http ) { rewrite ^/(.*) https://$server_name/ permanent; } #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://120.77.232.4:8099/; proxy_set_header HOST $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
nginx+tomcat session 丢失
nginx tomcat memcached 现在公司内部有2台web 服务器 49 和45 49安装了 nginx 2个tomcat memcached 45安装了 tomcat 如果把45服务器关闭掉 49的2个tomcat可以完成负载 但是把45的tomcat 启动起来 如果请求在2台服务器里 相互跳转 session 就会丢失 页面上面打印session id 也是 跳转一次 就变一次 但是 我同样的配置 在阿里云的2台服务器上面 又不会有这个问题 就是公司内部出问题的 公司内部2个服务器 是通过交换机连接在一起的 下面是nginx的配置文件 [root@localhost conf]# cat nginx.conf user root; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream 365hospital{ server 192.168.31.49:8001 weight=5; server 192.168.31.45:8001 weight=5; jvm_route $cookie_JSESSIONID|sessionid reverse; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://365hospital; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; add_header From 192.168.31.49; proxy_cookie_path /ROOT/ /; proxy_cookie_path /ROOT /; proxy_set_header Cookie $http_cookie; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
Python 植物大战僵尸代码实现(2):植物卡片选择和种植
这篇文章要介绍的是: - 上方植物卡片栏的实现。 - 点击植物卡片,鼠标切换为植物图片。 - 鼠标移动时,判断当前在哪个方格中,并显示半透明的植物作为提示。
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
记一次腾讯面试:进程之间究竟有哪些通信方式?如何通信? ---- 告别死记硬背
有一次面试的时候,被问到进程之间有哪些通信方式,不过由于之前没深入思考且整理过,说的并不好。想必大家也都知道进程有哪些通信方式,可是我猜很多人都是靠着”背“来记忆的,所以今天的这篇文章,讲给大家详细着讲解他们是如何通信的,让大家尽量能够理解他们之间的区别、优缺点等,这样的话,以后面试官让你举例子,你也能够顺手拈来。 1、管道 我们来看一条 Linux 的语句 netstat -tulnp | gr...
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
网络(8)-HTTP、Socket、TCP、UDP的区别和联系
TCP/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。 一、TCP与UDP的不同 1. 是否需要建立连接。 UDP在传送数据之前不需要先建立连接;TCP则提供面向连接的服务; 2. 是否需要给出确认 对方的传输层在收到UDP报文后,不需要给出任何确认,而 TCP需要给出确认报文,要提供可靠的、面向连接的传输服务。 3.虽然UDP不提供可靠交...
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
防劝退!数据结构和算法难理解?可视化动画带你轻松透彻理解!
大家好,我是 Rocky0429,一个连数据结构和算法都不会的蒟蒻… 学过数据结构和算法的都知道这玩意儿不好学,没学过的经常听到这样的说法还没学就觉得难,其实难吗?真难! 难在哪呢?当年我还是个小蒟蒻,初学数据结构和算法的时候,在忍着枯燥看完定义原理,之后想实现的时候,觉得它们的过程真的是七拐八绕,及其难受。 在简单的链表、栈和队列这些我还能靠着在草稿上写写画画理解过程,但是到了数论、图...
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
开挂的人生!那些当选院士,又是ACM/IEEE 双料Fellow的华人学者们
昨日,2019年两院院士正式官宣,一时间抢占了各大媒体头条。 朋友圈也是一片沸腾,奔走相告,赶脚比自己中了大奖还嗨皮! 谁叫咱家导师就是这么厉害呢!!! 而就在最近,新一年度的IEEE/ACM Fellow也将正式公布。 作为学术届的顶级荣誉,不自然地就会将院士与Fellow作比较,到底哪个含金量更高呢? 学术君认为,同样是专业机构对学者的认可,考量标准不一,自然不能一概而论。 但...
聊聊C语言和指针的本质
坐着绿皮车上海到杭州,24块钱,很宽敞,在火车上非正式地聊几句。 很多编程语言都以 “没有指针” 作为自己的优势来宣传,然而,对于C语言,指针却是与生俱来的。 那么,什么是指针,为什么大家都想避开指针。 很简单, 指针就是地址,当一个地址作为一个变量存在时,它就被叫做指针,该变量的类型,自然就是指针类型。 指针的作用就是,给出一个指针,取出该指针指向地址处的值。为了理解本质,我们从计算机模型说起...
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
代码详解:如何用Python快速制作美观、炫酷且有深度的图表
全文共12231字,预计学习时长35分钟生活阶梯(幸福指数)与人均GDP(金钱)正相关的正则图本文将探讨三种用Python可视化数据的不同方法。以可视化《2019年世界幸福报告》的数据为例,本文用Gapminder和Wikipedia的信息丰富了《世界幸福报告》数据,以探索新的数据关系和可视化方法。《世界幸福报告》试图回答世界范围内影响幸福的因素。报告根据对“坎特里尔阶梯问题”的回答来确定幸...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
(经验分享)作为一名普通本科计算机专业学生,我大学四年到底走了多少弯路
今年正式步入了大四,离毕业也只剩半年多的时间,回想一下大学四年,感觉自己走了不少弯路,今天就来分享一下自己大学的学习经历,也希望其他人能不要走我走错的路。 (一)初进校园 刚进入大学的时候自己完全就相信了高中老师的话:“进入大学你们就轻松了”。因此在大一的时候自己学习的激情早就被抛地一干二净,每天不是在寝室里玩游戏就是出门游玩,不过好在自己大学时买的第一台笔记本性能并不是很好,也没让我彻底沉...
如何写一篇技术博客,谈谈我的看法
前言 只有光头才能变强。 文本已收录至我的GitHub精选文章,欢迎Star:https://github.com/ZhongFuCheng3y/3y 我一直推崇学技术可以写技术博客去沉淀自己的知识,因为知识点实在是太多太多了,通过自己的博客可以帮助自己快速回顾自己学过的东西。 我最开始的时候也是只记笔记,认为自己能看得懂就好。但如果想验证自己是不是懂了,可以写成技术博客。在写技术博客的...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
面试还搞不懂redis,快看看这40道面试题(含答案和思维导图)
Redis 面试题 1、什么是 Redis?. 2、Redis 的数据类型? 3、使用 Redis 有哪些好处? 4、Redis 相比 Memcached 有哪些优势? 5、Memcache 与 Redis 的区别都有哪些? 6、Redis 是单进程单线程的? 7、一个字符串类型的值能存储最大容量是多少? 8、Redis 的持久化机制是什么?各自的优缺点? 9、Redis 常见性...
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
互联网公司的裁员,能玩出多少种花样?
裁员,也是一门学问,可谓博大精深!以下,是互联网公司的裁员的多种方法:-正文开始-135岁+不予续签的理由:千禧一代网感更强。95后不予通过试用期的理由:已婚已育员工更有责任心。2通知接下来要过苦日子,让一部分不肯同甘共苦的员工自己走人,以“兄弟”和“非兄弟”来区别员工。3强制996。员工如果平衡不了工作和家庭,可在离婚或离职里二选一。4不布置任何工作,但下班前必须提交千字工作日报。5不给活干+...
【设计模式】单例模式的八种写法分析
网上泛滥流传单例模式的写法种类,有说7种的,也有说6种的,当然也不排除说5种的,他们说的有错吗?其实没有对与错,刨根问底,写法终究是写法,其本质精髓大体一致!因此完全没必要去追究写法的多少,有这个时间还不如跟着宜春去网吧偷耳机、去田里抓青蛙得了,一天天的....
《面试宝典》:检验是否为合格的初中级程序员的面试知识点,你都知道了吗?查漏补缺
欢迎关注文章系列,一起学习 《提升能力,涨薪可待篇》 《面试知识,工作可待篇》 《实战演练,拒绝996篇》 也欢迎关注公 众 号【Ccww笔记】,原创技术文章第一时间推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《面试知识,工作可待篇》-Java笔试面试基础知识大全 前言 是不是感觉找工作面试是那么难呢? 在找工作面试应在学习的基础进行总结面试知识点,工作也指日可待,欢...
关于研发效能提升的思考
研发效能提升是最近比较热门的一个话题,本人根据这几年的工作心得,做了一些思考总结,由于个人深度有限,暂且抛转引入。 三要素 任何生产力的提升都离不开这三个因素:人、流程和工具,少了其中任何一个因素都无法实现。 人,即思想,也就是古人说的“道”,道不同不相为谋,是制高点,也是高层建筑的基石。 流程,即方法,也是古人说的“法”。研发效能的提升,也就是要提高投入产出比,既要增加产出,也要减...
微博推荐算法简述
在介绍微博推荐算法之前,我们先聊一聊推荐系统和推荐算法。有这样一些问题:推荐系统适用哪些场景?用来解决什么问题、具有怎样的价值?效果如何衡量? 推荐系统诞生很早,但真正被大家所重视,缘起于以”facebook”为代表的社会化网络的兴起和以“淘宝“为代表的电商的繁荣,”选择“的时代已经来临,信息和物品的极大丰富,让用户如浩瀚宇宙中的小点,无所适从。推荐系统迎来爆发的机会,变得离用户更近: 快...
相关热词 c#如何定义数组列表 c#倒序读取txt文件 java代码生成c# c# tcp发送数据 c#解决时间格式带星期 c#类似hashmap c#设置istbox的值 c#获取多线程返回值 c# 包含数字 枚举 c# timespan
立即提问