Apache websocket 和 Web 应用程序位于同一目录结构中

Apache websocket 和 Web 应用程序位于同一目录结构中

我有一个在 LAMP 服务器中运行的 Web 应用程序,现在我想将一些功能转移到 Web 套接字而不改变目录结构,这意味着 Web 应用程序的根目录应该是安全 HTTP,并且根目录下的“websock”目录应该是 Web 套接字应用程序目录。

我的网页可以正常工作,但此外我还希望 websock 目录也能正常工作

/home/webuser/www/html/app.mydomain.com -> https://app.mydomain.com/index.html (and many other web files)

沿着这一个

/home/webuser/www/html/app.mydomain.com/websocket -> https://app.mydomain.com/websocket/index.php

不幸的是,当我将浏览器指向https://app.mydomain.com/websocket/index.php我有

暂停服务

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at app.mydomain.com Port 443

然而,如果我用 php 客户端而不是 Apache2 服务器运行相同的代码,测试代码运行顺利

我的VirtualHost就是这样的

<Virtualhost 192.168.1.19:443>
    ServerName app.mydomain.com

    SSLEngine on
    SSLProxyEngine On
    ProxyRequests Off

    SSLCertificateFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.crt
    SSLCertificateKeyFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.key
    SSLCertificateChainFile /etc/ssl/private/app_mydomain.com/app_mydomain_com.ca-bundle

    DocumentRoot /home/webuser/www/html/app.mydomain.com

    ErrorDocument 503 /503.html
    ProxyPass /503.html !

    ProxyPass /websock http://localhost:3333/
    ProxyPassReverse /websock http://localhost:3333/

    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
    RewriteRule .* ws://localhost:3333%{REQUEST_URI} [P]
</Virtualhost>

我加载的 Apache 模块是

core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)
proxy_http_module (shared)
proxy_wstunnel_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)

由于某些原因,我无法运行单独的 php cli。我必须使用 Apache。如能帮助我更正虚拟主机,我将不胜感激

相关内容