diff --git a/conf/nginx.conf b/conf/nginx.conf index 43ec619..dfe5727 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,16 +1,21 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINALPATH__/public; + alias __FINALPATH__/; if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } index index.php; + try_files $uri $uri/ /index.php; location ~ [^/]\.php(/|$) { + if ($request_uri ~ "\/movim\/\?infos") { + return 403; + } + fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; @@ -19,7 +24,7 @@ location __PATH__/ { } location ~ ^__PATH__/ws/ { - proxy_pass http://127.0.0.1:__PORT__; + proxy_pass http://localhost:__PORT__; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; @@ -52,4 +57,4 @@ location ^~ /movim/config/ { location ^~ /movim/?infos { return 403; -} +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index 21f475f..c7c138e 100644 --- a/scripts/install +++ b/scripts/install @@ -137,6 +137,10 @@ cp ../conf/db.example.inc.php $final_path/config/db.inc.php ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config/db.inc.php" ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/db.inc.php" +## TODO: consider installation in a subpath +ynh_replace_string --match_string="'ws/'" --replace_string="'${path_url%/}/ws/'" \ + --target_file="$final_path/public/scripts/movim_websocket.js" + ynh_store_file_checksum --file="$final_path/config/db.inc.php" #================================================= diff --git a/scripts/restore b/scripts/restore index 56a9291..6c25ae1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,7 +73,7 @@ ynh_system_user_create --username=$app #================================================= # Restore permissions on app files -chown -R root: $final_path +chown -R www-data $final_path #================================================= # RESTORE THE PHP-FPM CONFIGURATION