개발자의 길

ubuntu (우분투) 20.04.x LTS - nginx 설치 본문

6. 리눅스

ubuntu (우분투) 20.04.x LTS - nginx 설치

자르르 2022. 3. 8. 11:07


sudo apt-get install make libperl-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev libxml2-dev libxslt1-dev libgd-dev libgeoip-dev google-perftools libgoogle-perftools-dev gcc g++
  • config 설정 (나중을 위해, 모든 옵션을 다 설치한다.)
./configure \
--prefix=/home/ubuntu/apps/nginx \
--error-log-path=/home/ubuntu/apps/nginx/log/error.log \
--http-log-path=/home/ubuntu/apps/nginx/log/access.log \
--sbin-path=/home/ubuntu/apps/nginx \
--conf-path=/home/ubuntu/apps/nginx/nginx.conf \
--pid-path=/home/ubuntu/apps/nginx/nginx.pid \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-google_perftools_module \
--with-cpp_test_module \
--with-debug
  • 설치
    • sudo make
    • sudo make install
      • ( 이상하게 sudo make && make install 로 한방에 하면 에러 나는 경우가 있다 )
  • nginx 실행 권한 주기
    • sudo chmod +s /home/ubuntu/apps/nginx/nginx
  • 실행
    • ./nginx
  • 정지
    • ./nginx -s stop
  • 재실행
    • ./nginx -s reload
      • reload가 잘 안되는 경우가 많아서, stop / start로 재실행 하는것을 권장한다.
  • 프로세스 확인
    • ps -ef | grep nginx

웹 확인

  • 해당 서버 도메인으로 접속(80포트)
    • 성공

  • config 설정
    • nginx.conf 열기
location / {
   try_files $uri $uri/ =404;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header Host $http_host;
   proxy_set_header X-NginX-Proxy true;
   proxy_pass http://127.0.0.1:3000;
   proxy_redirect off;
}

'6. 리눅스' 카테고리의 다른 글

WSL - Rocky 8.6 및 node 설치  (0) 2022.09.29
CentOs7 / Rocky8 에서 redis6 설치  (0) 2022.06.17
ubuntu docker 설치  (0) 2022.03.04
kubernates 기본 명령어  (2) 2021.12.30
redis 접속 방법 및 몇가지 명령어  (0) 2021.12.30


이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.
공유하기 링크
Comments