## 启动多个 HTTP 服务器 框架中的 `HTTP` 模块中都有集成一个单独的 `mix-httpd` 服务器,由于要同时启动多个,所以需要配置不同的端口,然后给每个服务都设置对应的 `Nginx` 代理。 ### 第一步: 修改每一个 `mix-httpd` 的端口不重复,配置文件路径: ~~~txt apps/[HTTP模块]/config/httpd.php ~~~ 然后启动全部的 `mix-httpd`。 ### 第二步: 为每个 `mix-httpd` 配置 Nginx 代理。 ~~~shell server { server_name my.test.com; listen 80; root /data/mixphp/apps/my/public/; index index.html; location = / { rewrite ^(.*)$ /index last; } location / { proxy_http_version 1.1; proxy_set_header Connection "keep-alive"; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (!-e $request_filename) { proxy_pass http://127.0.0.1:9501; } } } server { server_name shop.test.com; listen 80; root /data/mixphp/apps/shop/public/; index index.html; location = / { rewrite ^(.*)$ /index last; } location / { proxy_http_version 1.1; proxy_set_header Connection "keep-alive"; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (!-e $request_filename) { proxy_pass http://127.0.0.1:9511; } } } ~~~ ### 第三步: 重新启动 nginx 即可。