亲测:LNMP环境下,解决项目缓冲慢、502以及配置https的问题
在做的项目在nginx下访问缓冲时间过长,明显比apache下访问蛮11倍有余, 解决办法:
下面把具体解决办法放在下面,顺便把nginx下配置项目的配置贴出来,供大家使用 listen root error_page /
location / (!- rewrite ^(.*)$ /index.php?s=$ #location ~ # fastcgi_pass .: location ~ .php(.* try_files $uri = # fastcgi_pass .: fastcgi_pass .: fastcgi_split_path_info ^((?U).+.php)(/?.+ }
# 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/项目名称 (!- 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; } } 强制转成的配置 及访问会自动跳转到对应地址上 server { listen ; server_name wx.ssgsrz.com; rewrite ^/(.*) https: }
好了? 多余的不说了 ,大家复制拿去用就是了 谢谢大家浏览到这里~~~ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |