自建网速测试
大家好,我是Alex。今天教大家建立一个网速测试客户端网站。
源码地址:
https://wo.ci/download/speedtest_lite_c2s_by_jonvi_fixed.zip
原版地址:https://github.com/adolfintel/speedtest
服务器版本:ubuntu 16.04;网站容器:nginx1.11.13;php:php7.0.25
首先安装nginx
wget -chttps://nginx.org/download/nginx-1.11.13.tar.gz
tar -zxvf nginx-1.11.13.tar.gz
d nginx-1.11.13/
./configure --add-module=/root/ngx_brotli--add-module=/root/nginx-ct-1.3.2 --with-openssl=/root/openssl-OpenSSL_1_0_2h--with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module
安装php7.0
apt-get install php7.0-cli php7.0-cgiphp7.0-fpm
我把源码解压到了/var/www/html目录,所以我们在nginx中这样设置,我还开启了HTTPS
最后保存配置然后以此配置文件启动nginx
/usr/local/nginx/sbin/nginx -c/usr/local/nginx/conf/nginx.conf
访问主页就能看到网速测试界面
但是遇到了一个问题,客户端获取不到IP
这下可就着急了…然后我访问getIP.php,发现502了!!!!!!
我们去查看nginx日志
发现php7.0-fpm.sock连接访问存在权限问题,那么问题就好解决了!
查看文件/etc/php/7.0/fpm/pool.d/www.conf
取消这些前面的注释后…发现还是不行….我们查看nginx的用户
哦哦………我们修改nginx.conf,增加user www-data www-data
最后网站就完美运行啦~~