diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index bf6027fec..fc0feb747 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -11,3 +11,7 @@ export NVM_DIR="/root/.nvm" $NPM_BIN install $NPM_BIN run build +# prezip for faster deliver throw nginx +cd dist +find . -type f -name "*.css" -exec gzip -9 -k {} \; +find . -type f -name "*.js" -exec gzip -9 -k {} \; diff --git a/deployment/bare_metal/nginx/sites-available/gradido b/deployment/bare_metal/nginx/sites-available/gradido new file mode 100644 index 000000000..c32d82483 --- /dev/null +++ b/deployment/bare_metal/nginx/sites-available/gradido @@ -0,0 +1,73 @@ +server { + server_name _; + listen 80; + listen [::]:80; + + include /etc/nginx/common/protect.conf; + include /etc/nginx/common/protect_add_header.conf; + + root /var/www/html/gradido/community_server/webroot; + index index.php; + + gzip_static on; + + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.4-fpm.sock; + } + + location ~ /\.ht { + deny all; + } + + location /vue { + alias /var/www/html/gradido/frontend/dist; + index index.html; + + location ~* \.(png)$ { + expires 39d; + } + try_files $uri $uri/ /index.html = 404; + } + + location /account { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + rewrite /account/(.*) /$1 break; + + proxy_pass http://127.0.0.1:1200; + proxy_redirect off; + + + } + + location /login_api { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + rewrite /login_api/(.*) /$1 break; + + proxy_pass http://127.0.0.1:1201; + proxy_redirect off; + + + } + + + location / { + try_files $uri $uri/ /index.php?$args; + } + + access_log /var/log/nginx/access.log main; + +} diff --git a/deployment/bare_metal/nginx/sites-available/gradido_updating b/deployment/bare_metal/nginx/sites-available/gradido_updating new file mode 100644 index 000000000..df07e3715 --- /dev/null +++ b/deployment/bare_metal/nginx/sites-available/gradido_updating @@ -0,0 +1,29 @@ + +server { + server_name _; + listen 80; + listen [::]:80; + + include /etc/nginx/common/protect.conf; + include /etc/nginx/common/protect_add_header.conf; + + root /var/www/html/; + index updating.html; + + location /account { + alias /var/www/html/; + index updating.html; + } + location /vue { + alias /var/www/html/; + index updating.html; + } + + location ~ /\.ht { + deny all; + } + + access_log /var/log/nginx/access.log main; + +} + diff --git a/deployment/bare_metal/nginx/updating_original.html b/deployment/bare_metal/nginx/updating_original.html new file mode 100644 index 000000000..8975e3970 --- /dev/null +++ b/deployment/bare_metal/nginx/updating_original.html @@ -0,0 +1 @@ +Gradido Servers are updating..., please stand by and try again in some minutes diff --git a/deployment/bare_metal/update_all.sh b/deployment/bare_metal/update_all.sh index 1213ae146..b065a16d4 100755 --- a/deployment/bare_metal/update_all.sh +++ b/deployment/bare_metal/update_all.sh @@ -1,10 +1,9 @@ #!/bin/bash -EMPTY_UPDATE_HTML=/var/www/html/admin/updating_original.html -UPDATE_HTML=/var/www/html/admin/updating.html +EMPTY_UPDATE_HTML=/var/www/html/updating_original.html +UPDATE_HTML=/var/www/html/updating.html LOCK_FILE=/root/relay.lock -#PROJECT_PATH=/var/www/html/gradido -PROJECT_PATH=/root/code/gradido +PROJECT_PATH=/var/www/html/gradido SITE_CONFIG=stage1 UPDATE_SITE_CONFIG=stage1_updating