The server host of swoole can bind domain name, but it is not the effect of virtual host like apache or nginx. How to solve this problem?

new a server code in swoole is as follows:

$serv = new swoole_server("127.0.0.1", 9501);

now I want to create a HTTP server. I need to bind two domain names (www.a.com and www.b.com). After testing, the code is as follows

$serv = new swoole_server("www.a.com", 9501);
< H2 > question < / H2 >
  1. how can I implement a virtual host like apache httpd or nginx? That is, when multiple domain names are bound to the same ip, when accessed with different domain names, the content will be different?
Mar.03,2021

Nginx listens on multiple domain names and forwards them to swoole


document has a sentence:

swoole_http_server 's support for the Http protocol is incomplete and is recommended as an application server only. And add Nginx as a proxy at the front end

so, just add an agent at the front end.


Hello, how do you handle it now? Have you taken care of it? Am I asking this question now?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1c79b-33306.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1c79b-33306.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?