Welcome to Yumao′s Blog.
OpenWRT部署SpeedTest-X供測速使用
, 2020年12月24日 , Linux , 评论 在〈OpenWRT部署SpeedTest-X供測速使用〉中留言功能已關閉 ,

情況要求比較特殊
如果設備內存小于512M
推薦使用USB部署Swap分區
直接上步驟

部署的版本爲OpenWRT 19.07.x

opkg update
opkg install nginx-ssl php7 php7-fpm php7-mod-ctype php7-mod-curl php7-mod-json php7-mod-openssl zoneinfo-asia wget libustream-openssl
/etc/init.d/nginx stop
sed -i '/doc_root/c doc_root = ' /etc/php.ini
sed -i '/user =/c user = root' /etc/php7-fpm.d/www.conf
sed -i 's/listen.group/listengp/g' /etc/php7-fpm.d/www.conf
sed -i '/group =/c group = root' /etc/php7-fpm.d/www.conf
sed -i 's/listengp/listen.group/g' /etc/php7-fpm.d/www.conf
sed -i 's/service_start \$PROG/service_start \$PROG -R/g' /etc/init.d/php7-fpm
wget https://github.com/BadApple9/speedtest-x/archive/20201222.tar.gz -O /tmp/20201222.tar.gz
tar xzvf /tmp/20201222.tar.gz -C /www && rm -rf /tmp/20201222.tar.gz
mv /www/speedtest-x-* /www/speedtest

然後添加配置文件 默認以8080端口根目錄運行

>nano /etc/nginx/speedtest.conf

user root;
worker_processes auto;
worker_rlimit_nofile 15360;
pid /var/run/nginx-speedtest.pid;

events {
	worker_connections 4096;
}


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 error;

	gzip off;
	gzip_min_length 2048;
	gzip_comp_level 6;
	gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
	gzip_vary on;
	gzip_disable "MSIE [1-6]\.";

	proxy_buffering on;
	proxy_connect_timeout 600;
	proxy_read_timeout 600;
	proxy_send_timeout 600;
	proxy_buffer_size 4k;
	proxy_buffers 4 32k;
	proxy_busy_buffers_size 64k;

	proxy_temp_file_write_size 64k;
	proxy_temp_path /tmp;

	server_names_hash_bucket_size 128;

	server {
		listen 8080 default_server;
		listen [::]:8080 default_server;
		server_name _;
		client_max_body_size 64m;
		location / {
			root /www/speedtest;
			index index.html;
		}
		location ~ \.php$ {
			proxy_set_header Host $host;
			proxy_set_header X-real-ip $remote_addr;
			proxy_set_header X-Forwarded-For $http_x_forwarded_for;
			root /www/speedtest;
			fastcgi_pass unix://var/run/php7-fpm.sock;
			fastcgi_index index.php;
			fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
			include /etc/nginx/fastcgi_params;
                }
	}
}

最後啓動項目即可

/etc/init.d/php7-fpm restart
nginx -c /etc/nginx/speedtest.conf
关键字:, ,

评论已关闭