일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 리액트스타디
- 제로초예제
- 시퀄라이즈공부
- sementicversion
- NoSQL
- nodeJS
- mongo
- React
- NPM
- component
- node
- 리액트컴포넌트
- 클래스컴포넌트
- mongoose
- 리액트기초
- express-generator
- React Component
- 리액트
- npm명령어
- sequelize
- 시퀄라이즈
- MongoDB
- nodejs교과서
- Today
- Total
개발노트
nginx mac os 설치, 실행 본문
웹, 네트워크, HTTP, 웹서버
웹이란? 인터넷이라는 네트워크 체계 위에서 동작하는 서비스 중의 하나
인터넷은 시스템과 시스템을 연결해주는 네크워크 체계.
그 네트워크 체계 위에서 동작하는 서비스가 Web, FTP, Email
serving (정보제공) <-> client (요청) chrome browser
HTTP 통신규약 약속 (protocol)프로토콜
인터넷위에서 동작하는 서비스중하나인 웹 서비스를 이용하기 위해서는 준수해야되는 통신규약
그래서 웹서버를 HTTP server 라고 부르기도한다.
WebServer는 웹이라는 서비스를 제공하는 서버
HTTPServer HTTP라고하는 웹서비스를 사용할수있도록 도와주는 공통된약속 규약을 사용하는 서버.
apache 웹서버
nginx 차세대 웹서버
예전에 필요한 서비스들을 다 가지고 있어서 무거운 단점이 있는데 , nginx는 더 적은 자원으로 더 빠른 서비스를 제공(경량화)
웹서버 apache nginx 비교
apache
-클라이언트 요청을 처리하기 위한 멀티스레드방식
-웹 트래픽이 많아지만 여러 요청을 동시에 처리할수 없음
클라이언트 요청을 처리하기 위한 다중 스레드 방식인데 각 스레드는 한번에 하나의 연결만 처리할수 있어서
nginx
-이벤트 중심 접근방식을 사용한 클라이언트 요청 제공
-단일 스레드를 통해 여러 연결처리 가능
-제한된 하드웨어 리소스로도 여러 클라이언트 요청을 동시에, 효율적 처리 가능
-독립형 HTTP서버로 배치가 가능
nginx mac homebrew로 설치
brew install nginx
/usr/local/etc/nginx/에 설치됨
(M1칩 Big sur은 homebrew디렉토리 아래 설치되었음 터미널 잘 확인할것~~)
nginx 명령어 입력시 localhost:8080으로 접속하면
서버가 실행된걸 확인할수 있다
nginx 명령어
nginx
시작
nginx -s stop
종료
nginx -s reload
재시동
nginx -s quit
종료
-s는 Signal의 약자로 마스터 프로세스에 signal을 보낸다 ( stop / quit / reopen / reload 재가동중 로그파일다시오픈.. )
ps -ef | grep nginx
ps -ef | grep something 실행중인 모든 프로세스 중 something이 포함된 프로세스
ps(process status) 현재 돌아가고 있는 프로세스 확인
nginx -t -c /usr/local/etc/nginx/nginx.conf
-t 설정파일의 타당성을 체크 (nginx를 정지한 상태서 실행)
brew doctor `brew doctor --list-checks | grep -v stray_headers`
brew doctor 진단
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-e (파일생략된) 한줄 스크립트
brew service restart nginx
nginx 재시작
nginx.conf 파일 root경로 설정
http {
include /etc/nginx/mime.types;
server_tokens off;
client_max_body_size 32m;
upstream app_server {
server localhost:8081;
keepalive 128;
}
endpoints {
metadata_server;
}
server {
# Running port
listen 8080;
# 443 포트로 지정하면 포트 번호 기재 안해도됩니다 (https://localhost 로 실행가능)
listen 443 ssl;
# https를 사용하는 경우 crt, key 파일을 위치합니다
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location / {
# 이곳에 dist 파일을 위치합니다
root /////////////;
index index.html
}
}
}
root 에 dist파일이 있는 경로(path)를 입력하면 된다!
https://explainshell.com/explain?cmd=curl+-fsSL+example.org
'etc' 카테고리의 다른 글
pre-project 2 (0) | 2021.06.11 |
---|---|
front end framwork 통계 (0) | 2021.04.28 |
코딩테스트 site (0) | 2021.03.24 |
정규식 (0) | 2021.02.17 |
정규표현식 (0) | 2020.08.26 |