처음에는 socket.io를 구현해서 React로 채팅할 수 있는 화면을 간단히 구현해보려고 했다.
그러다보니... 소켓 통신 자체를 로컬끼리해서 의미가 있나 싶었다. 그래서 배포를 해보려고 시작하는데...
서버 코드랑 클라이언트 코드는 생략하겠습니다!
https://wikidocs.net/179437
위의 링크로 들어가서 회원가입부터 SSH 접속 및 기본 세팅까지 시작합니다.
여기서 원하는 도메인을 클릭하고 구매한다! 그리고...
서비스 관리로 들어가서 DNS 설정에서 도메인을 설정한다.
해당 화면이 나왔는지 확인하고, 인스턴스 ssh 명령어에 다음 코드를 작성하고 잠깐 끈다.
sudo systemctl stop apache2
위의 링크를 참고하면 쉽게 할 수 있다
npm i -g vercel
vercel
> > No existing credentials found. Please log in:
? Log in to Vercel
● Continue with GitHub
○ Continue with GitLab
○ Continue with Bitbucket
○ Continue with Email
○ Continue with SAML Single Sign-On
─────────────────────────────────
○ Cancel
$ vercel
Vercel CLI 32.0.0
? Set up and deploy “~\OneDrive\바탕 화면\socket.io\chatting”? [Y/n] y
? Which scope do you want to deploy to? hanseungjune
? Link to existing project? [y/N] n
In which directory is your code located? ./
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
git clone https://github.com/your-username/your-repo.git
cd your-repo
npm install
sudo apt-get update
sudo apt-get install certbot
sudo apt-get install python3-certbot-apache
sudo certbot --apache -d chattingsite.store
sudo certbot renew --dry-run
scp -i C:\Users\tmdwn\Downloads\keypairname.pem "C:\Users\tmdwn\OneDrive\바탕 화면\index.js" ubuntu@[인스턴스 ip]:~/chatting-server/
sudo node index.js