mirror of
https://github.com/YunoHost-Apps/yourls_ynh.git
synced 2024-09-03 20:35:59 +02:00
nginx conf
This commit is contained in:
parent
36db10f436
commit
0d38efd7e2
2 changed files with 13 additions and 4 deletions
|
@ -1,8 +1,7 @@
|
||||||
location PATHTOCHANGE {
|
location PATHTOCHANGE {
|
||||||
alias ALIASTOCHANGE;
|
alias ALIASTOCHANGE;
|
||||||
if ($scheme = http) {
|
rewrite ^ ^/admin permanent;
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
index index.php;
|
index index.php;
|
||||||
try_files $uri $uri/ /index.php?$args;
|
try_files $uri $uri/ /index.php?$args;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
|
|
|
@ -12,6 +12,13 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check that admin user is an existing account
|
||||||
|
sudo yunohost user list --json | grep -q "\"username\": \"$admin_user\""
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
echo "Error : the chosen admin user does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate random password
|
# Generate random password
|
||||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
|
||||||
|
@ -42,7 +49,10 @@ sudo chown -R www-data: $final_path
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
||||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/yourls.conf
|
nginxconf=/etc/nginx/conf.d/$domain.d/yourls.conf
|
||||||
|
sudo cp ../conf/nginx.conf $nginxconf
|
||||||
|
sudo chown root: $nginxconf
|
||||||
|
sudo chmod 600 $nginxconf
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
Loading…
Reference in a new issue