mirror of
https://github.com/YunoHost-Apps/cryptpad_ynh.git
synced 2024-09-03 18:26:14 +02:00
Merge pull request #2 from YunoHost-Apps/nginxconf-patch1-correction
Nginxconf patch1 correction
This commit is contained in:
commit
b73fe61382
2 changed files with 40 additions and 43 deletions
|
@ -1,28 +1,26 @@
|
||||||
location / {
|
root ROOT_PATH;
|
||||||
if ($args ~ ver=) {
|
index index.html;
|
||||||
set $cacheControl max-age=31536000;
|
|
||||||
}
|
|
||||||
# Will not set any header if it is emptystring
|
|
||||||
add_header Cache-Control $cacheControl;
|
|
||||||
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
set $styleSrc "'unsafe-inline' 'self'";
|
|
||||||
set $scriptSrc "'self'";
|
|
||||||
set $connectSrc "'self' wss://cryptpad.fr wss://api.cryptpad.fr";
|
|
||||||
set $fontSrc "'self'";
|
|
||||||
set $imgSrc "data: *";
|
|
||||||
set $frameSrc "'self' beta.cryptpad.fr";
|
|
||||||
|
|
||||||
if ($uri = /pad/inner.html) {
|
if ($args ~ ver=) {
|
||||||
set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline'";
|
set $cacheControl max-age=31536000;
|
||||||
}
|
}
|
||||||
add_header Content-Security-Policy "default-src 'none'; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;";
|
# Will not set any header if it is emptystring
|
||||||
|
add_header Cache-Control $cacheControl;
|
||||||
|
|
||||||
location = /cryptpad_websocket {
|
set $styleSrc "'unsafe-inline' 'self'";
|
||||||
proxy_pass http://localhost:__PORT__/;
|
set $scriptSrc "'self'";
|
||||||
|
set $connectSrc "'self' wss://cryptpad.fr wss://api.cryptpad.fr";
|
||||||
|
set $fontSrc "'self'";
|
||||||
|
set $imgSrc "data: *";
|
||||||
|
set $frameSrc "'self' beta.cryptpad.fr";
|
||||||
|
|
||||||
|
if ($uri = /pad/inner.html) {
|
||||||
|
set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline'";
|
||||||
|
}
|
||||||
|
add_header Content-Security-Policy "default-src 'none'; style-src $styleSrc; script-src $scriptSrc; connect-src $connectSrc; font-src $fontSrc; img-src $imgSrc; frame-src $frameSrc;";
|
||||||
|
|
||||||
|
location = /cryptpad_websocket {
|
||||||
|
proxy_pass http://localhost:3000;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
@ -32,27 +30,25 @@ location / {
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection upgrade;
|
proxy_set_header Connection upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ /customize.dist/ {
|
location ^~ /customize.dist/ {
|
||||||
# This is needed in order to prevent infinite recursion between /customize/ and the root
|
# This is needed in order to prevent infinite recursion between /customize/ and the root
|
||||||
}
|
}
|
||||||
location ^~ /customize/ {
|
location ^~ /customize/ {
|
||||||
rewrite ^/customize/(.*)$ $1 break;
|
rewrite ^/customize/(.*)$ $1 break;
|
||||||
try_files /customize/$uri /customize.dist/$uri;
|
try_files /customize/$uri /customize.dist/$uri;
|
||||||
}
|
}
|
||||||
location = /api/config {
|
location = /api/config {
|
||||||
default_type text/javascript;
|
default_type text/javascript;
|
||||||
rewrite ^.*$ /customize/api/config break;
|
rewrite ^.*$ /customize/api/config break;
|
||||||
}
|
}
|
||||||
|
|
||||||
## TODO fix in the code so that we don't need this
|
## TODO fix in the code so that we don't need this
|
||||||
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard)$ {
|
location ~ ^/(register|login|settings|user|pad|drive|poll|slide|code|whiteboard)$ {
|
||||||
rewrite ^(.*)$ $1/ redirect;
|
rewrite ^(.*)$ $1/ redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
try_files /www/$uri /www/$uri/index.html /customize/$uri;
|
|
||||||
|
|
||||||
|
try_files /www/$uri /www/$uri/index.html /customize/$uri;
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ SETUP_SOURCE # Télécharge la source, décompresse et copie dans $final_path
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
# Modifie les variables dans le fichier de configuration nginx
|
# Modifie les variables dans le fichier de configuration nginx
|
||||||
sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo sed -i "s@ROOT_PATH@/var/www/$app@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
|
Loading…
Reference in a new issue