boseok-note
  • README
  • javascript
    • 함수형 자바스크립트
    • core
      • 이벤트루프 (Event Loop)
      • boxing, unboxing
      • prototype
      • 실행컨텍스트
      • hoisting
      • 클로져(Closure)
      • arguments
      • Scope - 스코프 - 유효범위
    • api
      • Promise
      • Fetch API
      • worker-api
      • Web API
    • lib
      • rxjs
        • rxjs
    • 호스트객체?
    • es6
      • var-let-const
      • template-literals
      • async-await
    • tip
      • array-like
      • Object literal, new Object
    • dom-api
      • HTML Element get Text
      • get-size
      • scrollToBottom
    • for in, for of 차이
    • storage
    • Constructor (생성자)
    • Javascript
    • module
  • front-end
    • vuejs
      • vue-rx
      • README
        • 1-start
        • 2-basic-component
        • 3-add-component
        • 4-advanced-component
        • 5-dynamic-methods-event
        • 6-internal-process
      • next-tick
      • compare-react
      • v-model-with-props
      • v-for
      • vuejs
      • vuex
    • browser
      • dom
      • cssom
      • reflow, repaint
      • 렌더링 트리(Rendering Tree)
      • web-standard
    • css
      • text-ellipse
      • white-space
      • css layout
    • Pre-render
    • react-native
      • react-native
    • 최적화 관련
    • reactjs
      • performance
      • reactjs
    • CSR, SSR
  • server-side
    • letsencrypt
    • auto-deploy
    • nlb
    • Certbot, aws https setting with wildcard
    • mysql
    • node.js
      • npm
        • npm install
      • node-dynamodb
      • node에서 간편하게 letsencrypt를 사용하여 https 구현하는 방법
    • Docker
    • nginx
    • Amazon Web Service
    • nginx https 설정
  • design-pattern
    • observer
    • flux
    • README
  • coop
    • git
      • gitignore
      • remote
      • ssh key 사용하기
      • password
      • credential
      • git
  • cs
    • port
    • data-structure
      • tree
      • binary-tree
    • network
      • home-router
      • tcp-udp
      • http
    • process
  • etc
    • sync-async
    • seo
      • seo
      • SEO Check Point
    • rest
    • unity
      • methods
Powered by GitBook
On this page
  • 설치
  • 간단한 설정 방법
  1. server-side

nginx

static 파일을 제공할 수 있는 웹서버이다.

대표적인 웹서버 아파치와는 다르게 비동기로 작동한다.

서버에 많은 부하가 생길 경우의 성능을 예측하기 쉽게 해준다.

설치

ubuntu 16 기준으로 작성하였습니다.

ubuntu 18에서는 apt-get 명령어가 apt로 변경되었습니다.

sudo apt-get update
sudo apt-get install nginx

웹브라우저에 ip주소를 입력하고 접속하면 welcome to nginx 화면이 나온다.

1. 서비스 목록을 확인
 - service --status-all|grep +
2. 방화벽 확인
 - sudo ufw app list
 - sudo ufw allow 'Nginx HTTP'
 - sudo ufw status
3. 서비스되는지 확인
 - systemctl status nginx
4. 서비스 정지
 - sudo systemctl stop nginx
 - stop 외에 start, restart, reload, disable, enable 명령어가 있다.
5. cd /var/www/html => build 된 project를 deploy하면 된다.
6. 로그 확인
 - /var/log/nginx/access.log 혹은 error.log

간단한 설정 방법

ubuntu 16버전 이상 기준 설정파일이 있는곳

vi /etc/nginx/sites-available/default
vi /etc/nginx/nginx.conf

nginx에 여러개의 웹이 올라갈거라면

default 대신에 도메인을 정의하고

정의한 도메인을 default에 설정해주면 된다.

모듈로 관리해서 편해진다.

server {
  listen  80;
  server_name boseok.me;
  return 301 https://$host$request_uri;
  # https로 redirect. or proxy_pass를 사용하자.
}

server {
  # SSL configuration
  listen 443 ssl default_server;
  listen [::]:443 ssl default_server;
  # https 기본포트로 설정. 다른 포트를 입력하면 접속할때 도메인 뒤에 포트번호가 붙어야한다.

  ssl_certificate /인증서경로/fullchain.pem;
  ssl_certificate_key /인증서경로/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers HIGH:!aNULL:!MD5;
  # 인증서 설정

  root /var/www/boseok_log/build;
  # 설정한 포트로 접속할때, 기본 path

  server_name boseok.me;

  # path뒤에 param을 설정할 수 있다. ex) location /boseok {...} 
  location / { 
    # SPA이기때문에 설정해놓았습니다.
    try_files $uri $uri/ /index.html;
  }

}
PreviousDockerNextAmazon Web Service

Last updated 6 years ago