📝 Server config examples for Firebase, Caddy and Apache

This commit is contained in:
Alicia Sykes 2021-12-05 22:22:12 +00:00 committed by GitHub
parent d35bd9457b
commit 68640afc87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 1 deletions

View File

@ -617,6 +617,8 @@ Note, that if you choose not to use `server.js` to serve up the app, you will lo
Example Configs
- [NGINX](#nginx)
- [Apache](#apache)
- [Caddy](#caddy)
- [Firebase](#firebase-hosting)
- [cPanel](#cpanel)
### NGINX
@ -638,6 +640,9 @@ server {
}
}
```
To use HTML5 history mode (`appConfig.routingMode: history`), replace the inside of the location block with: `try_files $uri $uri/ /index.html;`.
Then upload the build contents of Dashy's dist directory to that location.
For example: `scp -r ./dist/* [username]@[server_ip]:/var/www/dashy/html`
@ -652,6 +657,15 @@ In your Apache config, `/etc/apche2/apache2.conf` add:
AllowOverride All
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
```
Add a `.htaccess` file within `/var/www/html/dashy/.htaccess`, and add:
@ -664,6 +678,39 @@ RewriteRule ^ index.html [QSA,L]
Then restart Apache, with `sudo systemctl restart apache2`
### Caddy
Caddy v2
```
try_files {path} /
```
Caddy v1
```
rewrite {
regexp .*
to {path} /
}
```
### Firebase Hosting
Create a file names `firebase.json`, and populate it with something similar to:
```
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
```
### cPanel
1. Login to your WHM
2. Open 'Feature Manager' on the left sidebar
@ -704,4 +751,4 @@ You can push your build image, by running: `docker push ghcr.io/OWNER/IMAGE_NAME
**[⬆️ Back to Top](#management)**
---
---