Triển khai với pages router (ok)

# Default server configuration
server {
  listen 80;
  listen [::]:80;
  server_name next.clickme.id.vn;
  return 301 https://$host$request_uri;
}
# HTTPS server block
server {
  listen 443 ssl;
  listen [::]:443 ssl;
  server_name next.clickme.id.vn;
  ssl_certificate /etc/letsencrypt/live/next.clickme.id.vn/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/next.clickme.id.vn/privkey.pem;
  include /etc/letsencrypt/options-ssl-nginx.conf;
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
  location /images/ {
    proxy_pass https://admin.pigroup.tqdesign.vn/;
    proxy_set_header Host admin.pigroup.tqdesign.vn;
  }
  location / {
    proxy_pass http://localhost:3001;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_cache_bypass $http_upgrade;
  }
}
sudo ln -s /etc/nginx/sites-available/next.clickme.id.vn /etc/nginx/sites-enabled/
sudo certbot --nginx -d next.clickme.id.vn
pm2 start npm --name "nextbrand" -- start
PORT=3001 pm2 start npm --name "nextbrand" -- start
pm2 start "npm run start" --name nextbrand --env PORT=3001
PORT=3001 pm2 start npm --name "nextbrand" -- start
Chú ý: Nếu đã khởi động với PORT=3001 rồi chỉ cẩn sử dụng pm2 restart 5 làm được

Last updated

Was this helpful?