1

I have installed/host erpnext app using Nginx config.

With the same config I tried to do it using Apache server but it is not working.

Did any one tried this before?

halfer
  • 19,824
  • 17
  • 99
  • 186
Shivkumar kondi
  • 6,458
  • 9
  • 31
  • 58

1 Answers1

2

This is my currently working configuration (Apache 2.4 with Let's encrpyt SSL).

Socket.io was the main problem, finally I found a way to make it work (transport=polling requests to /socket.io must be http, all other requests to /socket.io must be 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>
Enrico Detoma
  • 3,159
  • 3
  • 37
  • 53
  • Trying to get this set up with apache as well. my socketio insists on polling on port 9000 which the local socketio is also listening on – 111 Feb 11 '21 at 06:24