์ƒˆ์†Œ์‹

DevOps/Server

[Nginx] ์„ค์น˜ ๋ฐ ๋ช…๋ น์–ด ์ •๋ฆฌ

  • -

 

 

 

nginx์˜ ์„ค์น˜ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๊ธฐ๋กํ•˜๋Š” ๋ชฉ์ ์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ์šฉ์œผ๋กœ๋งŒ ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.


nginx ์„ค์น˜ ๊ด€๋ จ

 

์ตœ์‹ ๋ฒ„์ „ ๊ด€๋ฆฌ

apt update && apt upgrade

 

ํ•„์š” ํŒจํ‚ค์ง€ ์„ค์น˜

sudo apt install curl gnupg2 ca-certificates lsb-release

 

nginx repository ๋“ฑ๋ก (mainline / stable)

# mainline
echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list

# stable
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list

 

๊ณต์‹ ์„œ๋ช…ํ‚ค๋ฅผ ๋ฐ›์•„์™€์„œ apt๊ฐ€ ํŒจํ‚ค์ง€์˜ ์ง„์œ„์—ฌ๋ถ€๋ฅผ ํ™•์ธ

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt-key fingerprint ABF5BD827BD9BF62

 

apt ์ตœ์‹ ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธ ํ›„ nginx ์„ค์น˜

sudo apt update
sudo apt install nginx

 

์„ค์น˜ ํ™•์ธ

nginx -v ๋˜๋Š” nginx -V

 

 

๋ช…๋ น์–ด ๊ด€๋ จ

 

์‹คํ–‰

sudo systemctl start nginx
sudo service nginx start

 

์ค‘์ง€

sudo systemctl stop nginx
sudo service nginx stop

 

์žฌ์‹คํ–‰

sudo systemctl restart nginx
sudo service nginx restart

 

nginx ๊ตฌ์„ฑ ํ…Œ์ŠคํŠธ

** Nginx ์„œ๋ฒ„์˜ ๊ตฌ์„ฑ ํŒŒ์ผ์„ ๋ณ€๊ฒฝํ•  ๋•Œ๋งˆ๋‹ค ์„œ๋น„์Šค๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๊ฑฐ๋‚˜ ๋‹ค์‹œ ๋กœ๋“œํ•˜๊ธฐ ์ „์— ๊ตฌ์„ฑ์„ ํ…Œ์ŠคํŠธ

sudo nginx -t

 

nginx ์ƒํƒœ ํ™•์ธ

sudo systemctl status nginx

 

nginx ์„ค์น˜(๋ฒ„์ „) ํ™•์ธ

sudo nginx -v
sudo nginx -V (Nginx ๋ฒ„์ „๊ณผ ๊ตฌ์„ฑ ์˜ต์…˜)

 

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜Š

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๐Ÿ‘