Web Server: Difference between revisions

From Wreckroom
Jump to navigation Jump to search
No edit summary
No edit summary
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The Synology hosts [https://wreckroom.nyc https://wreckroom.nyc] over 443 using a NGINX Reverse Proxy via <code>localhost:3000</code>.
= Synology Site Management =
==PM2==


'''PM2''' is a process manager that serves the [https://en.wikipedia.org/wiki/Npm npm] NexJS App [https://wreckroom.nyc https://wreckroom.nyc]
Both sites are hosted on '''mainsqueeze''' (Synology) behind NGINX Reverse Proxy, served over 443.


Upon restarting the Synology, you will to restart PM2 in <code>/volume1/wreckroom.nyc/wreckroom</code> by following these steps:
{| class="wikitable"
! Site !! Local Port !! Directory
|-
| [https://wreckroom.nyc wreckroom.nyc] || <code>localhost:3000</code> || <code>/volume2/wreckroom.nyc/wreckroom.nyc</code>
|-
| [https://justinbjur.com justinbjur.com] || <code>localhost:3001</code> || <code>/volume2/justinbjur.com/justinbjur.com</code>
|}


#End all processes: <code>sudo pm2 delete all</code>.
== Updating Site Content ==
#Start the [https://en.wikipedia.org/wiki/Npm npm] process using '''PM2''': <code>sudo pm2 start npm -- start</code>.
# Make changes locally and commit to GitHub
# SSH into mainsqueeze: <code>ssh guernica@wreckroom.nyc</code>
# Navigate to the site and pull:
## <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code> (or justinbjur.com)
## <code>git pull</code>
# Restart pm2: <code>sudo pm2 restart wreckroom.nyc</code> (or justinbjur.com)


If you are having issues with '''PM2''' process manager serving the NextJs app (when <code>sudo npm run start</code> works fine), use the above steps as well.
== PM2 ==
'''PM2''' is a process manager that keeps both Next.js apps alive on the server.


==Certificates==
=== Current Processes ===
If you make changes to a Certificate's FQDN, in addition to migrating the certificate, you ''must'' go to Control Panel / Login Portal / Advanced / Reverse Proxy. The hostname must be changed there for everything to work properly! This took half a day to figure out last time, hope it saves you some time in the future :)
{| class="wikitable"
! Name !! Command
|-
| <code>wreckroom.nyc</code> || <code>npm run start</code>
|-
| <code>justinbjur.com</code> || <code>npm run start</code>
|}
 
=== After a Synology Reboot ===
PM2 should auto-resume if <code>pm2 save</code> was run. If not, restart manually:
# <code>cd /volume2/wreckroom.nyc/wreckroom.nyc</code>
# <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code>
# <code>cd /volume2/justinbjur.com/justinbjur.com</code>
# <code>sudo pm2 start npm --name "justinbjur.com" -- run start</code>
# <code>sudo pm2 save</code>
 
=== Troubleshooting ===
If a site is down and pm2 shows an error, delete and restart that process:
# <code>sudo pm2 delete wreckroom.nyc</code>
# <code>sudo pm2 start npm --name "wreckroom.nyc" -- run start</code>
# <code>sudo pm2 save</code>
 
== Certificates ==
If you modify a certificate's FQDN, you '''must''' also update the reverse proxy entry.
 
'''Control Panel Login Portal Advanced Reverse Proxy'''
 
Update the hostname there — without this step the site will not resolve correctly even after migrating the cert. This has cost half a day before, don't skip it.

Latest revision as of 16:55, 28 April 2026

Synology Site Management[edit]

Both sites are hosted on mainsqueeze (Synology) behind NGINX Reverse Proxy, served over 443.

Site Local Port Directory
wreckroom.nyc localhost:3000 /volume2/wreckroom.nyc/wreckroom.nyc
justinbjur.com localhost:3001 /volume2/justinbjur.com/justinbjur.com

Updating Site Content[edit]

  1. Make changes locally and commit to GitHub
  2. SSH into mainsqueeze: ssh guernica@wreckroom.nyc
  3. Navigate to the site and pull:
    1. cd /volume2/wreckroom.nyc/wreckroom.nyc (or justinbjur.com)
    2. git pull
  4. Restart pm2: sudo pm2 restart wreckroom.nyc (or justinbjur.com)

PM2[edit]

PM2 is a process manager that keeps both Next.js apps alive on the server.

Current Processes[edit]

Name Command
wreckroom.nyc npm run start
justinbjur.com npm run start

After a Synology Reboot[edit]

PM2 should auto-resume if pm2 save was run. If not, restart manually:

  1. cd /volume2/wreckroom.nyc/wreckroom.nyc
  2. sudo pm2 start npm --name "wreckroom.nyc" -- run start
  3. cd /volume2/justinbjur.com/justinbjur.com
  4. sudo pm2 start npm --name "justinbjur.com" -- run start
  5. sudo pm2 save

Troubleshooting[edit]

If a site is down and pm2 shows an error, delete and restart that process:

  1. sudo pm2 delete wreckroom.nyc
  2. sudo pm2 start npm --name "wreckroom.nyc" -- run start
  3. sudo pm2 save

Certificates[edit]

If you modify a certificate's FQDN, you must also update the reverse proxy entry.

Control Panel → Login Portal → Advanced → Reverse Proxy

Update the hostname there — without this step the site will not resolve correctly even after migrating the cert. This has cost half a day before, don't skip it.