You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache2 ProxyPass 500错误:OnlyOffice Docker反向代理配置问题

Hey Johannes, let's troubleshoot that 500 error you're seeing with your OnlyOffice reverse proxy setup. I’ve dealt with similar config issues before, so here’s what to check and fix step by step:

1. Missing Required Apache Modules

First off, Apache needs specific modules enabled to handle reverse proxying and SSL connections. If these aren’t turned on, you’ll get a 500 error without much fanfare. Run these commands to enable them:

sudo a2enmod proxy proxy_http proxy_ssl ssl headers
sudo systemctl restart apache2

This enables the core proxy modules, SSL support, and header manipulation (which helps OnlyOffice recognize the original HTTPS request).

2. Incorrect Backend Protocol in Proxy Rules

Your current config points to https://localhost:8888/, but most OnlyOffice Docker containers expose port 80 (HTTP) by default—you probably mapped that container port to your server’s 8888 port. Trying to connect to an HTTP port with HTTPS will cause a handshake failure, triggering the 500 error.

Fix this by switching the proxy target to HTTP:

ProxyPass / http://localhost:8888/
ProxyPassReverse / http://localhost:8888/

Don’t worry about security here—Apache handles the HTTPS connection with your users, and the proxy traffic stays on your server’s local loopback (safe from external snooping).

3. Incomplete SSL Certificate Configuration

Your <VirtualHost> block is missing the critical lines that tell Apache where to find your Let’s Encrypt certificates. Without these, Apache can’t establish a valid HTTPS connection, leading to a 500 error. Add these lines (adjust paths to match your Let’s Encrypt setup):

SSLCertificateFile /etc/letsencrypt/live/office.example.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/office.example.org/privkey.pem

Let’s Encrypt stores certificates in /etc/letsencrypt/live/[your-domain]/ by default, so double-check the paths are correct.

4. Check Apache Error Logs for Exact Details

If you’re still hitting 500 after the above fixes, the Apache error log will tell you exactly what’s wrong. Run this command to tail the log in real-time while testing your connection:

tail -f /var/log/apache2/error.log

Look for lines like "module not found", "SSL certificate error", or "connection refused to localhost:8888"—these will point you straight to the root cause.

Full Working Config Example

Here’s a polished version of your VirtualHost with all the fixes included:

<VirtualHost *:443>
    ServerName office.example.org

    # Let's Encrypt SSL Certificates
    SSLCertificateFile /etc/letsencrypt/live/office.example.org/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/office.example.org/privkey.pem

    # Proxy Settings
    ProxyPreserveHost On
    ProxyPass / http://localhost:8888/
    ProxyPassReverse / http://localhost:8888/

    # Optional: Improve reliability and security
    ProxyTimeout 300
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
</VirtualHost>

After updating the config, restart Apache again and test your connection to https://office.example.org—it should load the OnlyOffice interface without the 500 error.

内容的提问来源于stack exchange,提问作者Johannes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:13:07