feat: init
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
---
|
||||
description: Use a custom domain with Twake
|
||||
---
|
||||
|
||||
# 🔗 Custom domain + HTTPS
|
||||
|
||||
::: info
|
||||
We do not offer the possibility to edit the nginx configuration present in the docker-compose containers yet. To enable https you first need to install nginx and configure on your machine.
|
||||
|
||||
Your nginx installation will be used to forward the requests from https to the docker-compose http port.
|
||||
|
||||
The last step is to tell Twake that the frontend is accessed from a different domain and protocol to handle the redirections.
|
||||
:::
|
||||
|
||||
#### Use port 80 or 443 over https
|
||||
|
||||
To use 443 create a new nginx install and attach a proxy to port 8000 + certauto.
|
||||
If you use Apache2 go on the [Apache2 configuration page](apache2-configuration.md).
|
||||
|
||||
> Follow this thread if you have issues with websockets and reverse proxy: [https://community.twake.app/t/twake-on-docker-behind-apache-proxy/78](https://community.twake.app/t/twake-on-docker-behind-apache-proxy/78)
|
||||
|
||||
```text
|
||||
# /etc/nginx/site-enabled/default
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
}
|
||||
|
||||
location /socketcluster/ {
|
||||
proxy_pass http://127.0.0.1:8000/socketcluster/;
|
||||
# this magic is needed for WebSocket
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_connect_timeout 7d;
|
||||
proxy_send_timeout 7d;
|
||||
proxy_read_timeout 7d;
|
||||
}
|
||||
```
|
||||
|
||||
#### Configure domain name
|
||||
|
||||
You must edit the configuration in both `configuration/frontend/environment.ts` and `configuration/backend/Parameters.php`
|
||||
|
||||
```text
|
||||
//Exemple of environment.ts
|
||||
export default {
|
||||
env_dev: false,
|
||||
mixpanel_enabled: false,
|
||||
sentry_dsn: false,
|
||||
mixpanel_id: false,
|
||||
front_root_url: 'https://twake.acme.com',
|
||||
api_root_url: 'https://twake.acme.com',
|
||||
websocket_url: 'wss://twake.acme.com'
|
||||
};
|
||||
```
|
||||
|
||||
```text
|
||||
//To change in Parameters.php
|
||||
...
|
||||
"env" => [
|
||||
...
|
||||
"server_name" => "https://twake.acme.com/",
|
||||
],
|
||||
...
|
||||
```
|
||||
|
||||
> Dont forget to restart your docker-compose 😉 and rebuild the frontend:
|
||||
> `docker-compose exec nginx yarn build`
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
---
|
||||
description: "\U0001F64F From Dahpril (community) https://github.com/TwakeApp/Twake/issues/76"
|
||||
---
|
||||
|
||||
# Apache2 configuration
|
||||
|
||||
#### Apache vhost
|
||||
|
||||
You need to create a vhost listening on port 443.
|
||||
|
||||
_For exemple with certbot :_
|
||||
|
||||
_1. Create a vhost listening on port 80 with ServerName equals to your custom domain. Don't define any document root. 2. Then, use certbot to get a certificate and automatically create your vhost listening on port 443_
|
||||
|
||||
```text
|
||||
sudo certbot --apache --email your_email -d your_domain --agree-tos --redirect --noninteractive
|
||||
```
|
||||
|
||||
#### Reverse proxy
|
||||
|
||||
You have now to configure your reverse proxy directive. Head up to your 443 vhost configuration file and paste those directives \(place them after server and ssl directives\) :
|
||||
|
||||
```text
|
||||
RewriteEngine on
|
||||
RewriteCond ${HTTP:Upgrade} websocket [NC]
|
||||
RewriteCond ${HTTP:Connection} upgrade [NC]
|
||||
RewriteRule .* "wss://127.0.0.1:8000/$1" [P,L]
|
||||
|
||||
ProxyRequests off
|
||||
|
||||
<Location />
|
||||
ProxyPass http://127.0.0.1:8000/
|
||||
ProxyPassReverse http://127.0.0.1:8000/
|
||||
ProxyPreserveHost On
|
||||
</Location>
|
||||
<Location /socketcluster>
|
||||
ProxyPass ws://127.0.0.1:8000/socketcluster
|
||||
ProxyPassReverse ws://127.0.0.1:8000/socketcluster
|
||||
ProxyPreserveHost On
|
||||
</Location>
|
||||
|
||||
<Proxy *>
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from All
|
||||
</Proxy>
|
||||
|
||||
RequestHeader set X-Forwarded-port "80"
|
||||
```
|
||||
|
||||
Be careful to NOT type trailing slash for ws location \(it won't work\).
|
||||
|
||||
I'm not sure that all directives are needed, but this configuration works for me.
|
||||
|
||||
#### Configuring remoteip
|
||||
|
||||
You also need to configure remoteip mod from apache with this command :
|
||||
|
||||
```text
|
||||
a2enmod remoteip
|
||||
```
|
||||
|
||||
Then, edit /etc/apache2/conf-available/remoteip.conf to fit with this content :
|
||||
|
||||
```text
|
||||
RemoteIPHeader X-Real-IP
|
||||
RemoteIPTrustedProxy 127.0.0.1 ::1
|
||||
```
|
||||
|
||||
You can now enable the configuration of remoteip and restart Apache :
|
||||
|
||||
```text
|
||||
a2enconf remoteip
|
||||
service apache2 restart
|
||||
```
|
||||
|
||||
Return to the section "Configure domain name" of [Custom domain + HTTPS](./README.md#configure-domain-name) page to continue the configuration.
|
||||
Reference in New Issue
Block a user