我在nginx的nginx.conf中通过include servers/*.server来添加多个server。
这个其中一个server块:
server {
server_name localhost;
listen 8060;
charset utf-8;
location / {
root /Code/public;
index index.php index.html;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/usr/local/etc/nginx/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我对端口这一块不是很熟悉,我的问题是:
我的mac上的监听8888,8080,80端口的server块都能正常工作,但是我重新添加一个server块,监听比如8070端口。浏览器中反问:localhost:8070就会报错localhost 拒绝了我们的连接请求。
之前遇到的问题:我在mac上配置vscode和xdebug调试php代码,debugger配置监听9000端口发现9000被php-fpm监听了,所以我把debugger换成了监听9001。能够正常启动vscode的debugger,但是无论如何都不会命中断点。所以我把php-fpm连接nginx的方式换成了socket的方式,让debugger继续使用9000端口,这时就可以正常命中断点了,这是什么问题?
貌似都是端口的问题?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
一般
8070端口也属于逻辑端口,楼主看下这个端口是不是被占用了,使用netstat看看这个端口目前状态,然后楼主开这么多端口是为了干啥,菜鸟表示好奇