Cryptpad: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
(Apache Proxy)
(node.js und cryptpad)
Zeile 106: Zeile 106:
 
systemctl restart apache2.service  && node server
 
systemctl restart apache2.service  && node server
 
</source>
 
</source>
 +
 +
 +
=== als daemon - starten stoppen ===
 +
 +
* https://maker-tutorials.com/node-js-init-script-neustart-reboot-automatisch-starten-linux-raspberry-pi/

Version vom 21. November 2020, 15:21 Uhr


Installation

Apache Proxy

  • bash
a2enmod ssl
a2enmod rewrite
a2enmod auth_basic
a2enmod proxy proxy_wstunnel proxy_http
a2enmod proxy*
  • /etc/apache2/sites-enabled/cryptpad.domain.tld.conf
<VirtualHost *:80>
        ServerName cryptpad.domain.tld
        Redirect permanent / https://cryptpad.domain.tld
</VirtualHost>

<VirtualHost *:443>
        ServerName cryptpad.domain.tld
        ServerAdmin admin@domain.com

    # Turn SSL on
    SSLEngine on
    SSLProxyEngine On

    # ProxyPreserveHost On to prevent SSL handshake fail for valid domainn.
    # Note: requires valid SSL Certificate obviously
    ProxyPreserveHost On

    # Do not enable proxying with ProxyRequests until you have secured your server.
    # Open proxy servers are dangerous both to your network and to the Internet at large.
    ProxyRequests Off

    # Certificate chain. Note: also add these in Cryptpad config.js as privKeyAndCertFiles value
        #    SSLCertificateFile /etc/letsencrypt/live/cryptpad.domain.com/fullchain.pem
        #    SSLCertificateKeyFile /etc/letsencrypt/live/cryptpad.domain.com/privkey.pem
        SSLCertificateKeyFile /etc/ssl/private/live/domain.tld/privkey.pem
        SSLCertificateFile /etc/ssl/private/live/domain.tld/cert.pem
        SSLCertificateChainFile /etc/ssl/private/live/domain.tld/chain.pem
#    Include /etc/letsencrypt/options-ssl-apache.conf

    # This is the "httpSafePort" from the Cryptpad config.js.
    # Not sure if this should be here. Note: in my setup changing this to port 3000 results in a 502 proxy error
    #ProxyPass / http://localhost:3001/
    ProxyPass / http://195.17.149.245:3001/
    ProxyPassReverse / http://195.17.149.245:3001/
    #ProxyPassReverse / http://localhost:3001/

    # Activate the Apache RewriteEngine
    RewriteEngine On

    # Catch websocket requests. Change this to value of your websocketPath in Cryptpad config.js
    RewriteCond %{REQUEST_URI}  ^/cryptpad_websocket     [NC]

    # Rewrite to websocket. Port number should be value of httpPort in Cryptpad config.js
    #RewriteRule /(.*)           ws://localhost:3000/$1  [P]
    RewriteRule /(.*)           ws://195.17.149.245:3000/$1  [P]

    ErrorLog ${APACHE_LOG_DIR}/error.cryptpad.domain.tld.log
    CustomLog ${APACHE_LOG_DIR}/access.cryptpad.domain.tld.log combined


    #<Location />
    #    AuthType Basic
    #    ...
    </Location>
</VirtualHost>

node.js und cryptpad

npm install -g bower
bower install
bower install --allow-root
git clone https://github.com/xwiki-labs/cryptpad.git cryptpad.domain.tld
cd /var/www/cryptpad.domain.tld/
cd config/
cp config.example.js config.js
cd /var/www/cryptpad.domain.tld/
  • /var/www/cryptpad.netz.coop/config/config.js - ausschließlich angepasste optionen (muss an entsprechenden stellen geändert werden, rest wie config.example.js
module.exports = {
	httpUnsafeOrigin: 'http://cryptpad.domain.tld:3000/',
	httpSafeOrigin: "https://cryptpad.domain.tld",
	httpAddress: 'cryptpad.domain.tld',
	httpSafePort: 3001,
	adminEmail: 'i.did.not.read.my.config@cryptpad.domain.tld',
	blockDailyCheck: true,
	defaultStorageLimit: 500 * 1024 * 1024,
	logLevel: 'error',
	
}


systemctl restart apache2.service  && node server


als daemon - starten stoppen