<?php
$http = new swoole_http_server("0.0.0.0", 8811);
print_r("a");
$http->set([
'enable_static_handler' => true,
'document_root' => "/home/wwwroot/l2.l2.l2/static",//設置根目錄這裏根據你自己的路徑來寫
]);
代碼在瀏覽器不行,在服務器可以運行
說明代碼是沒有問題的,但是給擋住了,應該是防火牆的問題,在我設置防火牆之後,開放端口8811 80之後就可以了
[root@192 /]# systemctl start firewalld
[root@192 /]# firewall-cmd --permanent --add-port=80/tcp
Warning: ALREADY_ENABLED: 80:tcp
success
[root@192 /]# firewall-cmd --permanent --add-port=8811/tcp
success