mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
Fix path & location issues with trailing slash and sub-folder instalation.
This commit is contained in:
parent
8db382e9ee
commit
ea9e5bb5c4
4 changed files with 38 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
location PATHTOCHANGE {
|
location YNH_WWW_LOCATION {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,10 @@ location PATHTOCHANGE {
|
||||||
}
|
}
|
||||||
|
|
||||||
location @searx {
|
location @searx {
|
||||||
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
uwsgi_param SCRIPT_NAME 'YNH_WWW_PATH';
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
|
uwsgi_modifier1 30;
|
||||||
|
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
location = PATHTOCHANGE { rewrite ^ PATHTOCHANGE/; }
|
location = YNH_WWW_LOCATION { rewrite ^ YNH_WWW_LOCATION/; }
|
||||||
location PATHTOCHANGE {
|
|
||||||
|
location YNH_WWW_LOCATION {
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
try_files $uri @searx; }
|
try_files $uri @searx;
|
||||||
|
}
|
||||||
|
|
||||||
location @searx {
|
location @searx {
|
||||||
uwsgi_param SCRIPT_NAME PATHTOCHANGE;
|
uwsgi_param SCRIPT_NAME 'YNH_WWW_PATH';
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_modifier1 30;
|
uwsgi_modifier1 30;
|
||||||
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
|
||||||
|
|
|
@ -11,6 +11,18 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Path need a trailing slash, and location does not.
|
||||||
|
# See conf/nginx.conf* usage
|
||||||
|
location=$path
|
||||||
|
if [[ ! $path == */ ]]; then
|
||||||
|
# no trailing slash, so add it
|
||||||
|
path=$path/
|
||||||
|
fi
|
||||||
|
if [[ ! "$location" == "/" ]]; then
|
||||||
|
# remove possible trailing slash
|
||||||
|
location=${location%/}
|
||||||
|
fi
|
||||||
|
|
||||||
# Save specific settings
|
# Save specific settings
|
||||||
sudo yunohost app setting searx is_public -v $is_public
|
sudo yunohost app setting searx is_public -v $is_public
|
||||||
|
|
||||||
|
@ -71,7 +83,8 @@ sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
||||||
sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
|
sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
sed -i "s@YNH_WWW_LOCATION@$location@g" ../conf/nginx.conf*
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf*
|
||||||
if [ "$path" != "/" ];
|
if [ "$path" != "/" ];
|
||||||
then
|
then
|
||||||
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
||||||
|
|
|
@ -5,8 +5,17 @@ domain=$(sudo yunohost app setting searx domain)
|
||||||
path=$(sudo yunohost app setting searx path)
|
path=$(sudo yunohost app setting searx path)
|
||||||
is_public=$(sudo yunohost app setting searx is_public)
|
is_public=$(sudo yunohost app setting searx is_public)
|
||||||
|
|
||||||
# Remove trailing "/" for next commands
|
# Path need a trailing slash, and location does not.
|
||||||
path=${path%/}
|
# See conf/nginx.conf usage
|
||||||
|
location=$path
|
||||||
|
if [[ ! $path == */ ]]; then
|
||||||
|
# no trailing slash, so add it
|
||||||
|
path=$path/
|
||||||
|
fi
|
||||||
|
if [[ ! "$location" == "/" ]]; then
|
||||||
|
# remove possible trailing slash
|
||||||
|
location=${location%/}
|
||||||
|
fi
|
||||||
|
|
||||||
# Check depends installation
|
# Check depends installation
|
||||||
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python -y
|
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python -y
|
||||||
|
@ -62,7 +71,8 @@ sudo chown searx:searx -R $final_path
|
||||||
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
|
sed -i "s@YNH_WWW_LOCATION@$location@g" ../conf/nginx.conf*
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf*
|
||||||
if [ "$path" != "/" ];
|
if [ "$path" != "/" ];
|
||||||
then
|
then
|
||||||
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
|
||||||
|
|
Loading…
Add table
Reference in a new issue