我已经使用 Nginx 配置安装/托管 erpnext 应用程序。
使用相同的配置,我尝试使用 Apache 服务器执行此操作,但它无法正常工作。
以前有人试过吗?
这是我当前的工作配置(带有 Let's encrpyt SSL 的 Apache 2.4)。
Socket.io 是主要问题,最后我找到了一种让它工作的方法(transport=polling
请求/socket.io
必须是http
,所有其他请求/socket.io
必须是 websocket)。
<VirtualHost *:443>
ServerAdmin erpnext@example.com
ServerName erpnext.example.com
DocumentRoot /home/frappe/frappe-bench/sites/erpnext.example.com/
ProxyPreserveHost On
ProxyRequests Off
ProxyTimeout 120
ProxyPass "/.well-known/" "!"
ProxyPass "/AutoDiscover/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/files/" "!"
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=polling [NC]
RewriteRule /(.*) http://localhost:9000/socket.io/$1 [P,L]
RequestHeader set Host "erpnext.example.com"
RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
ProxyPass "/socket.io" "ws://localhost:9000/socket.io/"
ProxyPassReverse "/socket.io" "ws://localhost:9000/socket.io/"
<Location "/socket.io">
RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
</Location>
Alias "/assets" "/home/frappe/frappe-bench/sites/assets"
<Directory /home/frappe/frappe-bench/sites/assets>
Options FollowSymLinks
Require all granted
</Directory>
Alias "/files" "/home/frappe/frappe-bench/sites/erpnext.example.com/public/files"
<Directory /home/frappe/frappe-bench/sites/erpnext.example.com/public/files>
Options FollowSymLinks
Require all granted
</Directory>
ProxyPass "/" "http://localhost:8000/"
ProxyPassReverse "/" "http://localhost:8000/"
<Location "/">
RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
</Location>
SSLCertificateFile /etc/letsencrypt/live/erpnext.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/erpnext.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>