cover-img

Deploy Golang menggunakan Linux(Ubuntu)

16 June, 2024

0

0

0

  1. Buat file `Systemd`
sudo nano /etc/systemd/system/myapp.service
  1. Isi konfigurasi
[Unit]
Description=My Go Application
After=network.target

[Service]
User=yourusername
Group=yourusergroup
ExecStart=/path/to/your/app/myapp
WorkingDirectory=/path/to/your/app
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target
  1. Reload systemd dan Enable Service
# Reload systemd manager configuration
sudo systemctl daemon-reload

# Enable the service to start on boot
sudo systemctl enable myapp.service

# Start the service now
sudo systemctl start myapp.service
  1. Check Status
sudo systemctl status myapp.service
  1. Layanan Log
sudo journalctl -u myapp.service -f
  1. Config nginx
server {

listen 80;
server_name chat.ximply.io;

location / {
proxy_pass http://127.0.0.1:3006;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

0

0

0

Hajar Aswad

Jakarta Selatan, Indonesia

Full Stack Developer | Web Developer | Backend Developer

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.