찾다
운영 및 유지보수엔진스cPanel을 사용하여 CentOS 7에서 Nginx 역방향 프록시를 구성하는 방법

cPanel은 현재 세계에서 가장 강력하고 사용하기 쉬우며 가장 인기 있는 가상 호스트 제어 시스템입니다. 많은 외국 호스트가 이 제어판을 사용합니다.

CentOS 7中怎么使用cPanel配置Nginx反向代理

먼저, 이 프로세스를 시작하려면 EPEL 라이브러리를 설치해야 합니다.

1단계: EPEL 라이브러리 설치

root@server1 [/usr]# yum -y install epel-releaseLoaded plugins: fastestmirror, tsflags, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 66.23.237.210
* base: mirrors.linode.com
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
   Package Arch Version Repository Size
========================================================================================
Installing:
epel-release noarch 7-5 extras 14 k

2단계: nDeploy의 CentOS RPM 라이브러리 설치

nDeploy의 CentOS RPM 라이브러리를 설치하면 됩니다. 필요한 nDeploy 웹 소프트웨어와 Nginx 플러그인을 설치합니다

root@server1 [/usr]# yum -y install http://rpm.piserve.com/nDeploy-release-centos-1.0-1.noarch.rpmLoaded plugins: fastestmirror, tsflags, universal-hooks
nDeploy-release-centos-1.0-1.noarch.rpm | 1.7 kB 00:00:00
Examining /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm: nDeploy-release-centos-1.0-1.noarch
Marking /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package nDeploy-release-centos.noarch 0:1.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
nDeploy-release-centos noarch 1.0-1 /nDeploy-release-centos-1.0-1.noarch 110

3단계: nDeploy 및 Nginx nDeploy 플러그인 설치

root@server1 [/usr]# yum --enablerepo=ndeploy install nginx-nDeploy nDeployLoaded plugins: fastestmirror, tsflags, universal-hooks
epel/x86_64/metalink | 9.9 kB 00:00:00
epel | 4.3 kB 00:00:00
ndeploy | 2.9 kB 00:00:00
(1/4): ndeploy/7/x86_64/primary_db | 14 kB 00:00:00
(2/4): epel/x86_64/group_gz | 169 kB 00:00:00
(3/4): epel/x86_64/primary_db | 3.7 MB 00:00:02

Dependencies Resolved

========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
nDeploy noarch 2.0-11.el7 ndeploy 80 k
nginx-nDeploy x86_64 1.8.0-34.el7 ndeploy 36 M
Installing for dependencies:
PyYAML x86_64 3.10-11.el7 base 153 k
libevent x86_64 2.0.21-4.el7 base 214 k
memcached x86_64 1.4.15-9.el7 base 84 k
python-inotify noarch 0.9.4-4.el7 base 49 k
python-lxml x86_64 3.2.1-4.el7 base 758 k

Transaction Summary
========================================================================================
Install 2 Packages (+5 Dependent packages)

서버에 Nginx 플러그인을 설치하고 위 단계에 따라 설치를 완료했습니다. . 이제 Nginx를 역방향 프록시로 구성하고 기존 cPanel 사용자 계정에 대한 가상 호스트를 생성할 수 있습니다. 이에 대해 다음 스크립트를 실행할 수 있습니다.

4단계: Nginx를 기본 프런트 엔드 웹 서버로 시작하고 기본 구성 파일 만들기

root@server1 [/usr]# /opt/nDeploy/scripts/cpanel-nDeploy-setup.sh enableModifying apache http and https port in cpanel

httpd restarted successfully.
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_watcher.service to /usr/lib/systemd/system/ndeploy_watcher.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_backends.service to /usr/lib/systemd/system/ndeploy_backends.service.
ConfGen:: saheetha
ConfGen:: satest

이 스크립트는 Nginx가 프런트 엔드 웹 서버 역할을 할 수 있도록 Apache 포트를 80에서 다른 포트로 수정하는 것을 볼 수 있습니다. -end web server , 기존 cPanel 사용자를 위한 가상 호스팅 프로필을 생성합니다. 완료되면 Apache 및 Nginx의 상태를 확인합니다.

Apache 상태:

root@server1 [/var/run/httpd]# systemctl status httpd● httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-01-18 06:34:23 UTC; 12s ago
Process: 25606 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 24760 (httpd)
CGroup: /system.slice/httpd.service
‣ 24760 /usr/local/apache/bin/httpd -k start

Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Starting Apache Web Server...
Jan 18 06:34:23 server1.centos7-test.com apachectl[25606]: httpd (pid 24760) already running
Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Started Apache Web Server.

Nginx 상태:

root@server1 [~]# systemctl status nginx● nginx.service - nginx-nDeploy - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2016-01-17 17:18:29 UTC; 13h ago
Docs: http://nginx.org/en/docs/
Main PID: 3833 (nginx)
CGroup: /system.slice/nginx.service
├─ 3833 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
├─25473 nginx: worker process
├─25474 nginx: worker process
└─25475 nginx: cache manager process

Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Starting nginx-nDeploy - high performance web server...
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Started nginx-nDeploy - high performance web server.

Nginx는 프런트 엔드 서버로 포트 80에서 실행되고 있으며 Apache 구성은 http 포트 9999 및 https 포트 4430에서 수신하도록 변경되었습니다. 그들의 상황을 살펴보시기 바랍니다:

root@server1 [/usr/local/src]# netstat -plan | grep httpdtcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN 17270/httpd
tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 17270/httpd
tcp6 0 0 :::4430 :::* LISTEN 17270/httpd
tcp6 0 0 :::9999 :::* LISTEN 17270/httpd
CentOS 7中怎么使用cPanel配置Nginx反向代理
root@server1 [/usr/local/src]# netstat -plan | grep nginxtcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 17802/nginx: master
tcp 0 0 45.79.183.73:80 0.0.0.0:* LISTEN 17802/nginx: master

기존 사용자를 위해 생성된 가상 호스트의 구성 파일은 "/etc/nginx/sites-enabled"에 있습니다. 이 파일 경로에는 기본 Nginx 구성 파일이 포함되어 있습니다.

root@server1 [/etc/nginx/sites-enabled]# ll | grep .conf-rw-r--r-- 1 root root 311 Jan 17 09:02 saheetha.com.conf-rw-r--r-- 1 root root 336 Jan 17 09:02 saheethastest.com.conf

도메인 이름의 가상 호스트 예:

server {

listen 45.79.183.73:80;#CPIPVSIX:80;# ServerNamesserver_name saheetha.com www.saheetha.com;
access_log /usr/local/apache/domlogs/saheetha.com main;
access_log /usr/local/apache/domlogs/saheetha.com-bytes_log bytes_log;

include /etc/nginx/sites-enabled/saheetha.com.include;

}

브라우저를 시작하여 웹사이트를 보고 웹 서버의 작동 상태를 확인할 수 있습니다. 설치 후 서버에서 웹 서비스 정보를 읽어보세요.

root@server1 [/home]# ip a | grep -i eth03: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
inet 45.79.183.73/24 brd 45.79.183.255 scope global dynamic eth0
root@server1 [/home]# nginx -vnginx version: nginx/1.8.0
CentOS 7中怎么使用cPanel配置Nginx反向代理

다음을 얻으려면 이 문장을 다시 작성하세요. cPanel에서 새로 생성된 모든 계정에 대해 Nginx는 해당 계정에 대한 가상 호스트를 생성합니다. 이러한 간단한 단계를 통해 Nginx를 CentOS 7/cPanel 서버에서 역방향 프록시로 구성할 수 있습니다.

역방향 프록시로서 Nginx의 장점

  1. 설치 및 구성이 쉽습니다.

  2. 효율이 높고 성능이 좋습니다.

  3. Ddos 공격을 예방하세요.

  4. PHP 재작성 규칙으로 .htaccess 사용을 지원합니다.

위 내용은 cPanel을 사용하여 CentOS 7에서 Nginx 역방향 프록시를 구성하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
이 기사는 亿速云에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제
Nginx vs. Apache : 웹 호스팅 및 트래픽 관리Nginx vs. Apache : 웹 호스팅 및 트래픽 관리Apr 12, 2025 am 12:04 AM

NGINX는 동시성이 높은 자원 소비 시나리오에 적합하지만 APACHE는 복잡한 구성 및 기능 확장이 필요한 시나리오에 적합합니다. 1.NGINX는 고성능과의 많은 동시 연결을 처리하는 것으로 알려져 있습니다. 2. Apache는 안정성과 풍부한 모듈 지원으로 유명합니다. 선택할 때는 특정 요구에 따라 결정해야합니다.

NGINX : 최신 웹 애플리케이션을위한 다목적 도구NGINX : 최신 웹 애플리케이션을위한 다목적 도구Apr 11, 2025 am 12:03 AM

nginxissentialderformodernwebapplicationsduetoitsrolessareareverseproxy, loadbalancer 및 Webserver, HighperformanceAndscalability를 제공합니다

Nginx SSL/TLS 구성 : HTTPS로 웹 사이트 보안Nginx SSL/TLS 구성 : HTTPS로 웹 사이트 보안Apr 10, 2025 am 09:38 AM

Nginx를 통해 웹 사이트 보안을 보장하려면 다음 단계가 필요합니다. 1. 기본 구성을 만들고 SSL 인증서 및 개인 키를 지정하십시오. 2. 구성 최적화, HTTP/2 및 OCSPStapling 활성화; 3. 인증서 경로 및 암호화 제품군 문제와 같은 공통 오류 디버그; 4. Let 'sencrypt 및 세션 멀티플렉싱 사용과 같은 응용 프로그램 성능 최적화 제안.

Nginx 인터뷰 질문 : ACE 귀하의 DevOps/System Admin 인터뷰Nginx 인터뷰 질문 : ACE 귀하의 DevOps/System Admin 인터뷰Apr 09, 2025 am 12:14 AM

NGINX는 고성능 HTTP 및 리버스 프록시 서버로 높은 동시 연결을 처리하는 데 능숙합니다. 1) 기본 구성 : 포트를 듣고 정적 파일 서비스를 제공합니다. 2) 고급 구성 : 리버스 프록시 및로드 밸런싱을 구현하십시오. 3) 디버깅 기술 : 오류 로그를 확인하고 구성 파일을 테스트하십시오. 4) 성능 최적화 : GZIP 압축을 활성화하고 캐시 정책을 조정합니다.

Nginx 캐싱 기술 : 웹 사이트 성능 향상Nginx 캐싱 기술 : 웹 사이트 성능 향상Apr 08, 2025 am 12:18 AM

Nginx 캐시는 다음 단계를 통해 웹 사이트 성능을 크게 향상시킬 수 있습니다. 1) 캐시 영역을 정의하고 캐시 경로를 설정하십시오. 2) 캐시 유효성 기간 구성; 3) 다른 컨텐츠에 따라 다른 캐시 정책을 설정합니다. 4) 캐시 저장 및로드 밸런싱을 최적화합니다. 5) 캐시 효과를 모니터링하고 디버그합니다. 이러한 방법을 통해 NGINX 캐시는 백엔드 서버 압력을 줄이고 응답 속도 및 사용자 경험을 향상시킬 수 있습니다.

Docker와 Nginx : 컨테이너화 된 응용 프로그램을 배포하고 스케일링합니다Docker와 Nginx : 컨테이너화 된 응용 프로그램을 배포하고 스케일링합니다Apr 07, 2025 am 12:08 AM

dockercompose를 사용하면 Nginx의 배포 및 관리를 단순화 할 수 있으며 Dockerswarm 또는 Kubernetes를 통한 스케일링은 일반적인 관행입니다. 1) DockerCompose를 사용하여 Nginx 컨테이너를 정의하고 실행하십시오. 2) Dockerswarm 또는 Kubernetes를 통한 클러스터 관리 및 자동 스케일링 구현.

고급 NGINX 구성 : 서버 블록 마스터 링 및 리버스 프록시고급 NGINX 구성 : 서버 블록 마스터 링 및 리버스 프록시Apr 06, 2025 am 12:05 AM

NGINX의 고급 구성은 서버 블록 및 리버스 프록시를 통해 구현 될 수 있습니다. 1. 서버 블록을 사용하면 여러 웹 사이트를 한쪽으로 실행할 수있게되면 각 블록은 독립적으로 구성됩니다. 2. 리버스 프록시는 요청을 백엔드 서버로 전달하여로드 밸런싱 및 캐시 가속도를 실현합니다.

Nginx 성능 튜닝 : 속도 및 낮은 대기 시간을 최적화합니다Nginx 성능 튜닝 : 속도 및 낮은 대기 시간을 최적화합니다Apr 05, 2025 am 12:08 AM

작업자 프로세스 수, 연결 풀 크기, GZIP 압축 및 HTTP/2 프로토콜을 활성화하고 캐시 및로드 밸런싱을 사용하여 NGINX 성능 튜닝을 달성 할 수 있습니다. 1. 작업자 프로세스 수 및 연결 풀 크기 조정 : Worker_ProcessesAuto; 이벤트 {worker_connections1024;}. 2. GZIP 압축 및 HTTP/2 프로토콜 활성화 : http {gzipon; server {listen443sslhttp2;}}. 3. 캐시 최적화 사용 : http {proxy_cache_path/path/to/cachelevels = 1 : 2k

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

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

AI Clothes Remover

AI Clothes Remover

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

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

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

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

SublimeText3 Linux 새 버전

SublimeText3 Linux 새 버전

SublimeText3 Linux 최신 버전