feat(): improve nginx config close #84

pull/92/head
Magicalex 2021-05-30 23:42:54 +02:00
parent e7e4db882f
commit 3b8ab7a74f
No known key found for this signature in database
GPG Key ID: A89B48B1788C3CB5
4 changed files with 17 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
docker-compose.yml docker-compose.yml
docker docker
flarum.env flarum.env
test.sh

View File

@ -202,6 +202,16 @@ docker exec -ti flarum extension list
File to change the vhost flarum `/etc/nginx/flarum/custom-vhost-flarum.conf` File to change the vhost flarum `/etc/nginx/flarum/custom-vhost-flarum.conf`
To use file custom-vhost-flarum.conf add volume `/etc/nginx/flarum` To use file custom-vhost-flarum.conf add volume `/etc/nginx/flarum`
Create file in `/mnt/docker/flarum/nginx/custom-vhost-flarum.conf`
```nginx
# Example of custom vhost flarum for nginx
# fix nginx issue for fof/sitemap (https://github.com/FriendsOfFlarum/sitemap)
location = /sitemap.xml {
try_files $uri $uri/ /index.php?$query_string;
}
```
### Custom composer repositories ### Custom composer repositories

View File

@ -57,6 +57,8 @@ http {
fastcgi_param REMOTE_ADDR $http_x_real_ip; fastcgi_param REMOTE_ADDR $http_x_real_ip;
} }
if (-f /etc/nginx/flarum/custom-vhost-flarum.conf) {
include /etc/nginx/flarum/custom-vhost-flarum.conf; include /etc/nginx/flarum/custom-vhost-flarum.conf;
} }
}
} }

View File

@ -65,15 +65,6 @@ if [ -f '/flarum/app/extensions/composer.repositories.txt' ]; then
done < /flarum/app/extensions/composer.repositories.txt done < /flarum/app/extensions/composer.repositories.txt
fi fi
# Custom vhost flarum nginx
if [ ! -e '/etc/nginx/flarum/custom-vhost-flarum.conf' ]; then
echo '# Example:
# fix for flagrow/sitemap (https://github.com/flagrow/sitemap)
# location = /sitemap.xml {
# try_files $uri $uri/ /index.php?$query_string;
# }' > /etc/nginx/flarum/custom-vhost-flarum.conf
fi
# if installation was performed before # if installation was performed before
if [ -e '/flarum/app/public/assets/rev-manifest.json' ] || [ -e '/flarum/app/public/assets/._flarum-installed.lock' ] ; then if [ -e '/flarum/app/public/assets/rev-manifest.json' ] || [ -e '/flarum/app/public/assets/._flarum-installed.lock' ] ; then
echo "[INFO] Flarum already installed, init app..." echo "[INFO] Flarum already installed, init app..."
@ -127,8 +118,9 @@ else
-e "s|<FLARUM_TITLE>|${FLARUM_TITLE}|g" /flarum/app/config.yml -e "s|<FLARUM_TITLE>|${FLARUM_TITLE}|g" /flarum/app/config.yml
# Install flarum # Install flarum
su-exec "${UID}:${GID}" php /flarum/app/flarum install --file=/flarum/app/config.yml && su-exec "${UID}:${GID}" php /flarum/app/flarum install --file=/flarum/app/config.yml \
touch /flarum/app/public/assets/._flarum-installed.lock && touch /flarum/app/public/assets/._flarum-installed.lock
echo "[INFO] End of flarum installation" echo "[INFO] End of flarum installation"
fi fi