Swoole命令行輸出但瀏覽器會超時

<?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

 

發佈了679 篇原創文章 · 獲贊 77 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章