CentOS7 Docker Nginx를 배포하고 실행하는 방법
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 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

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

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

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

Clothoff.io
AI 옷 제거제

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

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

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

드림위버 CS6
시각적 웹 개발 도구

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

뜨거운 주제











Pinetwork 노드에 대한 자세한 설명 및 설치 안내서이 기사에서는 Pinetwork Ecosystem을 자세히 소개합니다. Pi 노드, Pinetwork 생태계의 주요 역할을 수행하고 설치 및 구성을위한 전체 단계를 제공합니다. Pinetwork 블록 체인 테스트 네트워크가 출시 된 후, PI 노드는 다가오는 주요 네트워크 릴리스를 준비하여 테스트에 적극적으로 참여하는 많은 개척자들의 중요한 부분이되었습니다. 아직 Pinetwork를 모른다면 Picoin이 무엇인지 참조하십시오. 리스팅 가격은 얼마입니까? PI 사용, 광업 및 보안 분석. Pinetwork 란 무엇입니까? Pinetwork 프로젝트는 2019 년에 시작되었으며 독점적 인 Cryptocurrency Pi Coin을 소유하고 있습니다. 이 프로젝트는 모든 사람이 참여할 수있는 사람을 만드는 것을 목표로합니다.

Docker 컨테이너를 사용하여 사전 컴파일 된 패키지 (Windows 사용자의 경우)를 사용하여 소스 (숙련 된 개발자)를 컴파일하는 것을 포함하여 DeepSeek를 설치하는 방법에는 여러 가지가 있습니다. 공식 문서는 신중하게 문서를 작성하고 불필요한 문제를 피하기 위해 완전히 준비합니다.

Docker 컨테이너를 사용하여 Java EE 애플리케이션 배포: Dockerfile을 생성하여 이미지를 정의하고, 이미지를 빌드하고, 컨테이너를 실행하고, 포트를 매핑한 다음, 브라우저에서 애플리케이션에 액세스합니다. 샘플 JavaEE 애플리케이션: REST API는 Docker를 통해 배포한 후 localhost에서 액세스할 수 있는 데이터베이스와 상호 작용합니다.

답변: CI/CD 파이프라인 설정, 자동화된 테스트 및 배포 프로세스를 포함하여 빠른 반복을 달성하려면 PHPCI/CD를 사용하십시오. CI/CD 파이프라인 설정: CI/CD 도구를 선택하고, 코드 저장소를 구성하고, 빌드 파이프라인을 정의합니다. 자동화된 테스트: 단위 및 통합 테스트를 작성하고 테스트 프레임워크를 사용하여 테스트를 단순화합니다. 실제 사례: TravisCI 사용: TravisCI를 설치하고, 파이프라인을 정의하고, 파이프라인을 활성화하고, 결과를 봅니다. 지속적인 전달 구현: 배포 도구를 선택하고, 배포 파이프라인을 정의하고, 배포를 자동화합니다. 이점: 개발 효율성을 높이고 오류를 줄이며 납품 시간을 단축합니다.

1. 먼저 인터페이스를 연 후 왼쪽의 확장 아이콘 버튼을 클릭합니다. 2. 열린 확장 페이지에서 검색창 위치를 찾습니다. 3. 그런 다음 마우스로 Docker라는 단어를 입력하여 확장 플러그인을 찾습니다. 4 마지막으로 대상 플러그인을 선택하고 오른쪽을 클릭합니다. 하단에 있는 설치 버튼을 클릭하면 됩니다.

WordPress 사이트 파일 액세스가 제한됩니다. 최근 .txt 파일에 액세스 할 수없는 이유를 문제 해결하십시오. 미니 프로그램 비즈니스 도메인 이름을 구성 할 때 일부 사용자는 문제가 발생했습니다.

Docker 환경을 사용할 때 Docker 환경에 Extensions를 설치하기 위해 PECL을 사용하여 오류의 원인 및 솔루션. 종종 일부 두통이 발생합니다 ...

같은 시스템에서 여러 PHP 버전을 동시에 실행하는 것은 특히 다른 프로젝트가 다른 버전의 PHP에 의존 할 때 일반적인 요구 사항입니다. 똑같은 방법 ...
