Nginx   发布时间:2019-11-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

在做的项目在Nginx下访问缓冲时间过长,明显比apache下访问蛮11倍有余,

title="亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题" alt="亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题" src="https://cn.js-code.com/res/2019/02-03/18/dd0eaa5e724fdf96d6c3aad5294d56a1.png" >

解决办法:

 php-cgi的地址;,分支法解决并发量;php-cgi的进程数,(这里会受到机器资源的限制,因此,也并不能无限增加)

下面把具体解决办法放在下面,顺便把nginx下配置项目的配置贴出来,供大家使用

{ listen 你的域名; php; root PUBLIC; error_page / LOCATIOn /{ php index.html index.htm; (!-request_fileName) { rewrite ^(.*)$ /index.php?s=$ WARDed-For $proxy_add_x_forWARDed_for; 19 proxy_set_header Host $http_host; 20 proxy_redirect off; #LOCATIOn ~php$ { # fastcgi_pass .: LOCATIOn ~ \.php(.*{ #配置404 try_files $uri = # fastcgi_pass .: fastcgi_pass .: i_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+ ename $document_root$fastcgi_script_name; }

https # httpS server

{ listen 你的域名; root /usr/share/nginx/html/ ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:! ssl_protocols TLSv1 TLSv1. TLSv1. LOCATIOn /{ root /usr/share/nginx/html/项目名称 php; (!-request_fileName) { rewrite ^(.*)$ /index.php?s=$

          proxy_read_timeout 300;           proxy_connect_timeout 300;           proxy_set_header X-Real-IP $remote_addr;           proxy_set_header X-ForWARDed-For $proxy_add_x_forWARDed_for;           proxy_set_header Host $http_host;           proxy_redirect off;

          
         LOCATIOn ~ .*\.(php|php5)?{
               root  /usr/share/nginx/html/项目名称;           
          fastcgi_pass .:10;           fastcgi_index index.php;           fastcgi_param httpS on;           fastcgi_param SCRIPT_FILename $document_root$fastcgi_script_name;           include fastcgi_params; # line           include fastcgi.conf;         }      }   http强制转成https的配置 及访问http会自动跳转到https对应地址上  server {     listen ;     server_name wx.ssgsrz.com;     rewrite ^/(.*) https:request_uri? peRMANent;  }

好了  多余的不说了 ,大家复制拿去用就是了

谢谢大家浏览到这里~~~

大佬总结

以上是大佬教程为你收集整理的亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题全部内容,希望文章能够帮你解决亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: