Как заставить stream_socket_get_name
вернуть реальный IP-адрес от удаленного клиента?
$ip = stream_socket_get_name($socket, true);
Выше указано что-то вроде 127.0.0.1:39872
Nginx
server {
listen 8443 ssl;
server_name websocket.example.com;
ssl_certificate /var/ini/ssl/public.crt;
ssl_certificate_key /var/ini/ssl/private.key;
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:9000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 300;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $remote_addr;
}
}