Centos 7 설치 nginx (1)
설치 과정 은 주로 세 부분 으로 나 뉜 다.
주의: 불필요 한 번 거 로 움 을 피하 기 위해 설치 하기 전에 방화벽 을 닫 습 니 다
systemctl stop firewalld
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
2. nginx 설치
wget http://nginx.org/download/nginx-1.14.0.tar.gz
(다운로드) tar -zxvf nginx-1.14.0.tar.gz
(스트레스 해소) cd nginx-1.14.0
(경로 전환) ./configure --prefix=/usr --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/usr/local/run/nginx/nginx.pid --lock-path=/usr/local/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tem/nginx/client --http-proxy-temp-path=/var/tem/nginx/proxy --http-fastcgi-temp-path=/var/tem/nginx/fcgi --with-http_stub_status_module
(nginx 관련 매개 변 수 를 설정 하고 다음은 매개 변수의 구체 적 인 의미) nginx path prefix: "/usr"
nginx binary file: "/usr/local/sbin/nginx"
nginx modules path: "/usr/modules"
nginx configuration prefix: "/usr/local/nginx"
nginx configuration file: "/usr/local/nginx/nginx.conf"
nginx pid file: "/usr/local/run/nginx/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/tem/nginx/client"
nginx http proxy temporary files: "/var/tem/nginx/proxy"
nginx http fastcgi temporary files: "/var/tem/nginx/fcgi"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
make
make install
nginx -c /usr/local/nginx/nginx.conf
/usr/local/sbin/nginx -c /usr/local/nginx/nginx.conf
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s quit
pkill -9 nginx
3. systemctl 설정, systemctl 시작, nginx 정지
vi /usr/local/nginx/nginx.conf
pid /usr/local/run/nginx/nginx.pid;
find / -name nginx.conf
을 통 해 찾 을 수 있 습 니 다 ps aux|grep nginx
kill -9 id
/usr/lib/systemd/system/
경로 에 있 습 니 다. 이 경로 에서 ngix. service 파일 vi /usr/lib/systemd/system/nginx.service
다음 과 같은 내용 을 추가 합 니 다. [Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
/usr/local/sbin/nginx -c /usr/local/nginx/nginx.conf
[Service]
Type=forking
PIDFile=/usr/local/run/nginx/nginx.pid
ExecStartPre=/usr/local/sbin/nginx -t -c /usr/local/nginx/nginx.conf
ExecStart=/usr/local/sbin/nginx -c /usr/local/nginx/nginx.conf
ExecReload=/usr/local/sbin/nginx -s reload
ExecStop=/usr/local/sbin/nginx -s stop
ExecQuit=/usr/local/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
ngix. service 파일 을 유효 하 게 합 니 다 systemctl start/stop/reload/quit nginx.service
작 동, 정지, 재 개, 탈퇴 systemctl enable nginx.service
자동 시작 주의: nginx. service 파일 에 있 는 nginx 의 경로 /usr/local/sbin/nginx
는 절차 8 에 설 치 된 것 과 일치 해 야 합 니 다. 설정 파일 경로 /usr/local/nginx/nginx.conf
와 설정 파일 에 설 치 된 pid
는 절차 8 에 설 치 된 것 과 일치 해 야 합 니 다./usr/local/sbin/nginx -c /usr/local/nginx/nginx.conf
을 살 펴 보면 /usr/local/sbin/nginx
nginx 의 실행 가능 한 경 로 를 알 수 있 고 -c /usr/local/nginx/nginx.conf
시작 하 는 매개 변 수 를 통 해 시작 할 때 사용 하 는 nginx 설정 파일 을 변경 할 수 있 습 니 다.3. 총화
가상 컴퓨터 + centos 7 환경 에서 nginx 를 설치 하 는 과정 을 보 여 주 었 습 니 다. 다음 글 은 docker 에 nginx 를 설치 하 는 것 을 소개 합 니 다.글 은 편집 과정 에서 개인 소홀, 버 전 별 markdown 해상도 가 호 환 되 지 않 는 등 문자 쓰기 오류 로 인해 설치 에 실 패 했 을 수 있 습 니 다.본문 은 오리지널 에 속 하 므 로 인용 이 있 으 면 출처 를 밝 혀 주 십시오.의문 이나 잘못 이 있 으 면 지적 해 주시 거나 본인 에 게 연락 하 셔 도 됩 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
바이너리 파일cat 또는tail, 터미널 디코딩 시 처리 방법cat으로 바이너리 파일을 보려고 할 때 코드가 엉망이 되어 식은땀이 났다. 웹에서 스크롤된 정보의 처리 방법과alias의 설정을 요약합니다. reset 명령을 사용하여 터미널을 재설정합니다.이렇게 하면 고치지 못하...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.