Closed ming200825 closed 5 years ago
问题 解决了 是这里的问题 我的swoole 是http 服务 不是像php-fpm 那样的sock 所有要 用 upstream swoole { server swoole:9501; } 在用这个 转发 proxy_pass http://swoole$suffix;
你好 我也在配置 swoole 扩展 我安装了swoole扩展 ,问下具体的步骤,怎么配置PHP才能连接上swoole呢?
只需要做两步,第一,在yml里面配置暴露的端口号; 第二步,写好nginx配置文件即可.
php:
build:
context: ./services/php
args:
PHP_VERSION: php:${PHP_VERSION}-fpm-alpine
CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
PHP_EXTENSIONS: ${PHP_EXTENSIONS}
TZ: "$TZ"
container_name: php
ports:
- "9501:9501"
- "9502:9502"
- "9503:9503"
- "9504:9504"
- "9505:9505"
- "9506:9506"
extra_hosts:
- "www.site1.com:172.17.0.1"
volumes:
- ${SOURCE_DIR}:/www/:rw
- ${PHP_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
- ${PHP_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
- ${PHP_LOG_DIR}:/var/log/php
- ${DATA_DIR}/composer:/tmp/composer
restart: always
cap_add:
- SYS_PTRACE
networks:
- default
server {
listen 9502;
server_name xxxx.test *.xxxx.test;
root /www/xxxx;
index index.php index.html index.htm;
#charset koi8-r;
access_log /dev/null;
#access_log /var/log/nginx/nginx.xxxx.access.log main;
error_log /var/log/nginx/nginx.xxxx.error.log warn;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 443 ssl http2;
server_name xxxx.test *.xxxx.test;
root /www/xxxx;
index index.php index.html index.htm;
#charset koi8-r;
access_log /dev/null;
#access_log /var/log/nginx/nginx.xxxx.access.log main;
error_log /var/log/nginx/nginx.xxxx.error.log warn;
#error_page 404 /404.html;
ssl_certificate /ssl/localhost/localhost.crt;
ssl_certificate_key /ssl/localhost/localhost.key;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
[error] 12#12: *3 no resolver defined to resolve swoole2, proxy_pass http://172.21.0.6:9501$suffix; 这样可以用 proxy_pass http://swoole:9501$suffix; 这样用不了
看 你php 是这样配置的 不知道哪出错了