Load To Technical Architect

[Linux] Nginx Service 등록 본문

Web/nginx

[Linux] Nginx Service 등록

고지식한청춘 2020. 6. 11. 13:42
728x90

Nginx 서비스 등록

 

※ root 계정으로 작업

 

1. Service 파일 생성

# vi /etc/systemd/system/nginx.service

 

[Unit]

Description=The NGINX HTTP and reverse proxy server

After=syslog.target network.target remote-fs.target nss-lookup.target



[Service]

Type=forking

PIDFile=/run/nginx.pid

ExecStartPre=/usr/local/nginx/sbin/nginx -t

ExecStart=/usr/local/nginx/sbin/nginx

ExecReload=/usr/local/nginx/sbin/nginx -s reload

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true



[Install]

WantedBy=multi-user.target

 

2. systemctl daemon 재시작

# systemctl daemon-reload

 

 

◎ 정상적으로 Service가 등록되었는지 확인

# systemctl status nginx

728x90

'Web > nginx' 카테고리의 다른 글

[Linux] Nginx Tomcat Clustering  (0) 2020.06.15
[Linux] Nginx Tomcat 연동  (0) 2020.06.15
[Linux] Nginx 1.16.1 Compile  (0) 2020.06.11
Comments