[英]apache httpd-vhosts.conf who to redirect only socket.io calls from port 80
I am not deep in the apache configuration so after ++hours of google and experiments and getting nervous I need help concering that all requests to my "site-name" using port 80 always end in redirection to node.js socket.io server script. 我没有深入了解apache配置,所以在谷歌和实验的++小时之后并且变得紧张我需要帮助,假设使用端口80对我的“site-name”的所有请求总是以重定向结束到node.js socket.io服务器脚本。
From browser I request index.htm which shall do the socket.io stuff. 从浏览器我请求index.htm,它将执行socket.io的东西。
How to configure httpd-vhosts.conf to allow calls to php/js/html/.. (except index.htm) to "site-name" using port 80 not to be redirected to node.js ? 如何配置httpd-vhosts.conf以允许使用端口80调用php / js / html / ..(index.htm除外)为“site-name”而不是重定向到node.js?
(Xampp) Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 (Xampp)Apache / 2.4.25(Win32)OpenSSL / 1.0.2j PHP / 5.6.30
httpd-vhosts.conf looks like this httpd-vhosts.conf看起来像这样
<VirtualHost *:80>
ServerName site-name
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:8088/$1 [P,L]
ProxyPass http://localhost:8088/
ProxyPassReverse http://localhost:8088/
</VirtualHost>
index.htm: index.htm的:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Socket.io</title>
</head>
<body>
<h1>Communication with socket.io!</h1>
<script src="http://site-name/socket.io/socket.io.js"></script> <script>
var socket = io();
console.log("socketId: " + socket.id);
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'client-data' });
});
Thank's for your help Guido 谢谢你的帮助Guido
i have found the solution by simply adding 我通过简单地添加找到了解决方案
# no proxy for php cgi-bin
ProxyPass /php !
ProxyPass /cgi-bin !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.