1. 리소스 준비
dockerfile 파일
# "ported" by adam miller <maxamillion@fedoraproject.org> from # https://github.com/fedora-cloud/fedora-dockerfiles # # originally written for fedora-dockerfiles by # scollier <scollier@redhat.com> from centos:centos7 maintainer the centos project <cloud-ops@centos.org> run yum -y update; yum clean all run yum -y install epel-release tar ; yum clean all run yum -y install nginx ; yum clean all add nginx.conf /opt/deploy/nginx/nginx.conf run echo "daemon off;" >> /opt/deploy/nginx/nginx.conf #run curl https://git.centos.org/sources/httpd/c7/acf5cccf4afaecf3afeb18c50ae59fd5c6504910 \ # | tar -xz -c /usr/local/nginx/html \ # --strip-components=1 #run sed -i -e 's/apache/nginx/g' -e '/apache_pb.gif/d' \ # /usr/local/nginx/html/index.html expose 80 #cmd [ "/usr/local/nginx/sbin" ]
참고: 경로는 시스템에 존재해야 하며
nginx.conf 파일
# for more information on configuration, see: # * official english documentation: http://nginx.org/en/docs/ # * official russian documentation: http://nginx.org/ru/docs/ user nginx; worker_processes 1; error_log /usr/logs/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /run/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /usr/logs/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # load modular configuration files from the /etc/nginx/conf.d directory. # see http://nginx.org/en/docs/ngx_core_module.html#include # for more information. #include /etc/nginx/conf.d/*.conf; index index.html index.htm; server { listen 80; server_name localhost; root /usr/share/nginx/html; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { autoindex on; } # redirect server error pages to the static page /40x.html # error_page 404 /404.html; location = /40x.html { } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of ip-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # root html; # location / { # } #} # https server # #server { # listen 443; # server_name localhost; # root html; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols sslv2 sslv3 tlsv1; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; # location / { # } #} }
과 일치해야 합니다. 경로는 시스템에 존재하고 일치해야 합니다
2. 빌드 이미지 명령 실행
코드 복사 코드는 다음과 같습니다.
[root@localhost nginx]# sudo docker build --rm --tag os7/nginx:centos7
실행 스크린샷. 결과:
3. docker 이미지가 성공적으로 설치되고 빌드되었는지 확인하세요. bin/bash
참고: IP 주소가 192.168.32.129인 경우 /etc/hosts localhost
5에
192.168.32.129를 추가해야 합니다. 컨테이너가 성공적으로 생성되었는지 확인하고 docker ps
6. 컬 http://192.168.32.129에 성공적으로 접속했는지 테스트하세요:81
이 연결이 거부되었습니다. 어떻게 해야 하나요? 해결 방법이 있으니 먼저 컨테이너에 들어가 보겠습니다
7. 컨테이너에 docker exec -i -t small_hodgkin /bin/sh
8을 입력합니다.
nginx
9. 컨테이너 외부에서 컬 http://192.168.32.129:81 실행이 성공했습니다.
10. 가상 머신 외부의 브라우저를 통해 액세스하세요
위 내용은 CentOS7 Docker Nginx 배포 및 실행 예시 분석의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

Nginx는 높은 동시 요청을 처리하는 데 적합한 반면 Apache는 복잡한 구성 및 기능 확장이 필요한 시나리오에 적합합니다. 1.NGINX는 이벤트 중심의 비 블로킹 아키텍처를 채택하며, 대결 환경에 적합합니다. 2. Apache는 프로세스 또는 스레드 모델을 채택하여 복잡한 구성 요구에 적합한 풍부한 모듈 생태계를 제공합니다.

Nginx는 웹 사이트 성능, 보안 및 확장 성을 향상시키는 데 사용될 수 있습니다. 1) 리버스 프록시 및로드 밸런서로서 Nginx는 백엔드 서비스를 최적화하고 트래픽을 공유 할 수 있습니다. 2) 이벤트 중심 및 비동기 아키텍처를 통해 Nginx는 높은 동시 연결을 효율적으로 처리합니다. 3) 구성 파일을 사용하면 정적 파일 서비스 및로드 밸런싱과 같은 규칙을 유연하게 정의 할 수 있습니다. 4) 최적화 제안에는 GZIP 압축 활성화, 캐시 사용 및 작업자 프로세스 조정이 포함됩니다.

NginxUnit은 여러 프로그래밍 언어를 지원하며 모듈 식 디자인을 통해 구현됩니다. 1. 언어 모듈로드 : 구성 파일에 따라 해당 모듈을로드합니다. 2. 응용 프로그램 시작 : 호출 언어가 실행될 때 응용 프로그램 코드를 실행합니다. 3. 요청 처리 : 응용 프로그램 인스턴스로 요청을 전달하십시오. 4. 응답 반환 : 처리 된 응답을 클라이언트에 반환합니다.

Nginx와 Apache는 고유 한 장점과 단점이 있으며 다른 시나리오에 적합합니다. 1.NGINX는 높은 동시성 및 낮은 자원 소비 시나리오에 적합합니다. 2. Apache는 복잡한 구성 및 풍부한 모듈이 필요한 시나리오에 적합합니다. 핵심 기능, 성능 차이 및 모범 사례를 비교하면 요구에 가장 적합한 서버 소프트웨어를 선택할 수 있습니다.

질문 : nginx를 시작하는 방법? 답변 : nginx 스타트 업 설치 nginx verification nginx is nginx 시작 다른 시작 옵션을 자동으로 시작합니다.

nginx가 시작되었는지 확인하는 방법 : 1. 명령 줄을 사용하십시오 : SystemCTL 상태 nginx (linux/unix), netstat -ano | Findstr 80 (Windows); 2. 포트 80이 열려 있는지 확인하십시오. 3. 시스템 로그에서 nginx 시작 메시지를 확인하십시오. 4. Nagios, Zabbix 및 Icinga와 같은 타사 도구를 사용하십시오.

Nginx 서비스를 종료하려면 다음 단계를 따르려면 다음 단계를 결정합니다. Red Hat/Centos (SystemCTL 상태 NGINX) 또는 Debian/Ubuntu (서비스 NGINX 상태) 서비스 중지 : Red Hat/Centos (SystemCTL STOP NGINX) 또는 DEBIAN/UBUNTU (서비스 NGINX STOP) DIA AUTAL STARTUP (옵션) : RED HAT/CENTOS (SystemCTLED) 또는 DEBIAN/UBUNT (SystemCTLED). (Syst

Windows에서 Nginx를 구성하는 방법은 무엇입니까? nginx를 설치하고 가상 호스트 구성을 만듭니다. 기본 구성 파일을 수정하고 가상 호스트 구성을 포함하십시오. 시작 또는 새로 고침 Nginx. 구성을 테스트하고 웹 사이트를보십시오. SSL을 선택적으로 활성화하고 SSL 인증서를 구성하십시오. 포트 80 및 443 트래픽을 허용하도록 방화벽을 선택적으로 설정하십시오.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

WebStorm Mac 버전
유용한 JavaScript 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

DVWA
DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

Dreamweaver Mac版
시각적 웹 개발 도구
