NUXT SSL NGINX конфигурация PM2 | сайт NUXT не обновляется

#nginx #ssl #nuxt.js #pipeline #pm2

#nginx #ssl #nuxt.js #трубопровод #pm2

Вопрос:

Я запускаю сайт Vue/NUXT с PM2 на NGINX с SSL. Когда я запускаю «npm run build» на рабочем сервере, живой сайт не обновляет мои изменения. Может быть, какая-то проблема с кешем?? Или мой трубопровод неправильный? Пожалуйста, найдите всю мою конфигурацию NGINX и команды конвейера ниже. Все работает на сервере Ubuntu 20.04 с NodeJS Express. NUXT 2.14.7

 #server { # listen 80; # server_name example.com www.example.com test.example.com; # HTTP to HTTPS redirections for all the subdomains # return 301 https://$host$request_uri; #} server { server_name www.example.com; # ssl_* directives here # www to non-www for SEO canonical reasons return 301 http://example.com$request_uri;   listen 443 ssl http2; # managed by Certbot  ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem; # managed by Certbot  ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem; # managed by Certbot  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot  } server { server_name example.com; # ssl_* directives here location / {  proxy_pass http://127.0.0.1:3001;  proxy_http_version 1.1;  proxy_set_header Upgrade $http_upgrade;  proxy_set_header Connection 'upgrade';  proxy_set_header Host $host;  proxy_cache_bypass $http_upgrade;  } ##root /var/www/example.com/html; index index.html index.php index.htm index.nginx-debian.html; # PHP ##location ~ .php$ { ##include snippets/fastcgi-php.conf; ##fastcgi_pass unix:/run/php/php7.4-fpm.sock; ##} location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* .((ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|webp))$ { expires 24h; add_header Cache-Control private; } # (For WordPress permalinks) #location / { #try_files $uri $uri/ /index.php$is_args$args; #}   listen 443 ssl http2; # managed by Certbot  ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot  ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot  } server { server_name test.example.com; # ssl_* directives here root /var/www/example.com/test; index index.php index.html index.htm index.nginx-debian.html; # PHP location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* .((ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|webp))$ { expires 24h; add_header Cache-Control private; } # (For WordPress permalinks) location / { try_files $uri $uri/ /index.php$is_args$args; }   listen 443 ssl; # managed by Certbot  ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot  ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot  include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot  }   server {  if ($host = example.com) {  return 301 https://$host$request_uri;  } # managed by Certbot   listen 80; server_name example.com;  return 404; # managed by Certbot   } server {  if ($host = test.example.com) {  return 301 https://$host$request_uri;  } # managed by Certbot   listen 80; server_name test.example.com;  return 404; # managed by Certbot   }  

Я обновляю сайт на производственном сервере с помощью конвейера для Bitbucket:

 # I run ./deployApi.sh on the production server with below content: root="/var/www/example.com/html" cd $root echo -e 'e[1me[34mPulling code from remote..e[0mn' git pull https://exampleuser@bitbucket.org/exampleproject/examplerepo.git echo -e 'e[1me[34mnInstalling required packages..e[0mn' npm run build echo -e 'e[1me[34mnRestarting service..e[0mn' # Replace 1 with the ID of the service running your application pm2 start -- --port 3001 echo -e 'ne[1me[34mDeployment successfule[0m'   

Комментарии:

1. Здесь есть довольно много вещей. Не могли бы вы как-нибудь попытаться сузить круг подозреваемых? Пытаясь отладить, является ли это приложением Nuxt или проблемой Nginx, разместив его на Heroku или аналогично?

2. @kissu Раньше я размещал его в Vercel без проблем, так что либо мой файл NGINX выше, либо мой конвейер Bitbucket, развернутый выше, идет не так.