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

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

部署的版本爲OpenWRT 22.03.x

1
2
3
4
5
6
7
8
9
10
11
12
opkg update
opkg install nginx-ssl php8 php8-fpm php8-mod-ctype php8-mod-filter php8-mod-curl php8-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/php8-fpm.d/www.conf
sed -i 's/listen.group/listengp/g' /etc/php8-fpm.d/www.conf
sed -i '/group =/c group = root' /etc/php8-fpm.d/www.conf
sed -i 's/listengp/listen.group/g' /etc/php8-fpm.d/www.conf
sed -i 's/service_start \$PROG/service_start \$PROG -R/g' /etc/init.d/php8-fpm
tar xzvf /tmp/speedtest-x.tar.gz -C /www && rm -rf /tmp/speedtest-x.tar.gz
mv /www/speedtest-x-* /www/speedtest

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
>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/php8-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
                }
    }
}

最後啓動項目即可

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

评论已关闭