1. Linux에서 nginx 설치 및 구성
nginx를 처음 설치하는데, 그 과정에서 발생하는 문제들을 차근차근 해결해 나가고 있습니다.
securecrt 도구는 서버에 연결하고 로그인하는 데 사용됩니다.
1.1 rz 명령을 실행하면 대화 상자가 나타나고 업로드할 nginx 압축 패키지를 선택합니다.
#rz
1.2 압축 풀기
[root@vw010001135067 ~]# cd /usr/local/ [root@vw010001135067 local]# tar -zvxf nginx-1.10.2.tar.gz
1.3 nginx 폴더에 들어가서 ./configure 명령을 실행하세요.
[root@vw010001135067 local]# cd nginx-1.10.2 [root@vw010001135067 nginx-1.10.2]# ./configure
오류는 다음과 같이 보고됩니다.
checking for os + linux 2.6.32-431.el6.x86_64 x86_64 checking for c compiler ... not found ./configure: error: c compiler cc is not found
이 오류가 발생합니다. 그러면 gcc 패키지가 설치되지 않습니다.
1.3.1 gcc 설치
gcc 보기
[root@vw010001135067 nginx-1.10.2]# whereis gcc gcc:
gcc 설치
[root@vw010001135067 nginx-1.10.2]# yum -y install gcc
설치 성공 후 다시 확인
[root@vw010001135067 nginx-1.10.2]# whereis gcc gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
gcc가 설치되었는지 확인하세요.
1.3.2 계속해서 ./configure
[root@vw010001135067 nginx-1.10.2]# ./configure checking for os + linux 2.6.32-431.el6.x86_64 x86_64 checking for c compiler ... found ...... checking for pcre library ... not found checking for pcre library in /usr/local/ ... not found checking for pcre library in /usr/include/pcre/ ... not found checking for pcre library in /usr/pkg/ ... not found checking for pcre library in /opt/local/ ... not found ./configure: error: the http rewrite module requires the pcre library. you can either disable the module by using --without-http_rewrite_module option, or install the pcre library into the system, or build the pcre library statically from the source with nginx by using --with-pcre=<path> option.
를 실행하면 위와 같은 오류가 발생합니다. pcre-devel
[root@vw010001135067 nginx-1.10.2]# yum install pcre-devel
1.3.3을 설치하고 ./configure를 다시 실행하세요
error: the http gzip module requires the zlib library. you can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option.
이 오류가 있으면
yum install zlib-devel
1.3.4를 실행하세요. ./configure
[root@vw010001135067 nginx-1.10.2]# ./configure checking for os + linux 2.6.32-431.el6.x86_64 x86_64 checking for c compiler ... found + using gnu c compiler + gcc version: 4.4.7 20120313 (red hat 4.4.7-17) (gcc) ....... configuration summary + using system pcre library + openssl library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
1.4를 실행한 후에는 오류가 보고되지 않습니다. openssl 함수, sha1 함수를 사용하십시오. 그런 다음 openssl을 설치하고 sha1
[root@vw010001135067 nginx-1.10.2]# yum install openssl openssl-devel [root@vw010001135067 nginx-1.10.2]# install perl-digest-sha1.x86_64
1.4.1 SSL 모듈 실행을 활성화합니다./configure –with-http_ssl_module
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_ssl_module
1.4.2 “server+status” 페이지를 활성화하고 실행합니다./configure –with-http_stub_status_module
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_stub_status_module
The 위 두 개 동시에 두 개의 명령을 시작할 수 있습니다
코드 복사 코드는 다음과 같습니다.
[root@vw010001135067 nginx-1.10.2]# ./configure --with-http_stub_status_module --with-http_ssl_module
1.5 위의 구성이 통과되었습니다
make 명령을 실행하고 make install 명령을 실행합니다
[root@vw010001135067 nginx-1.10.2]# make [root@vw010001135067 nginx-1.10.2]# make install
이 시점에서 nginx가 성공적으로 실행되었습니다
1.6 환경 변수 구성
/etc/profile에 구성을 추가합니다
구성 파일을 엽니다
[root@vw010001135067 nginx-1.10.2]# vi /etc/profile
구성 파일에
#nginx configure export nginx_home=/usr/local/nginx-1.10.2 export path=$path:$nginx_home/sbin
를 추가합니다. 위와 같이 채우기 시작했는데 nginx -v를 사용하면 찾을 수 없습니다. 위의 nginx_home 구성 주소가 잘못되었음을 확인했습니다. 먼저 nginx의 설치 주소
[root@vw010001135067 nginx-1.10.2]# whereis nginx nginx: /usr/local/nginx
를 찾으세요. 위의 내용을
#nginx configure export nginx_home=/usr/local/nginx export path=$path:$nginx_home/sbin
로 변경하고
[root@vw010001135067 nginx-1.10.2]# source /etc/profile
를 실행하여 구성을 적용하세요.
1.7 nginx 버전 확인
[root@vw010001135067 nginx]# nginx -v nginx version: nginx/1.10.2
전체 과정이 성공적으로 완료되었습니다!
2. nginx.conf 수정
2.1 nginx 시작
내 nginx 서비스는 http://10.1.135.67/에 있습니다. 이제 nginx를 시작하세요
[root@vw010001135067 nginx]# cd /usr/local/nginx [root@vw010001135067 nginx]# nginx -c conf/nginx.conf
시작이 성공하고 http가 열립니다. 브라우저에서: //10.1.135.67/, 기본 포트 번호는 80입니다.
위에 표시된 것처럼 nginx는 정상적으로 작동합니다.
2.2 Tomcat 서비스 구성
이제 내 Tomcat 서비스는 10.1.29.15에 있으며 nginx를 통해 전달되어야 합니다. 그런 다음 nginx.conf를 열고 구성 파일을 수정합니다. 다음과 같이 추가하세요.
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024;#最大连接数,默认为512 accept_mutex on; #设置网路连接序列化,防止惊群现象发生,默认为on multi_accept on; #设置一个进程是否同时接受多个网络连接,默认为off #use epoll; #事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport } http { #文件扩展名与文件类型映射表 include mime.types; #默认文件类型,默认为text/plain 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"'; #combined为日志格式的默认值 access_log logs/access.log main; #允许sendfile方式传输文件,默认为off,可以在http块,server块,location块 sendfile on; sendfile_max_chunk 100k; #每个进程每次调用传输数量不能大于设定的值,默认为0,即不设上限。 #tcp_nopush on; #连接超时时间,默认为75s,可以在http,server,location块。 keepalive_timeout 65; #gzip on; upstream upload { server 10.1.29.15:8080; } error_page 404 https://www.baidu.com; #错误页 server { keepalive_requests 120; #单连接请求上限次数。 listen 80; #监听端口 server_name localhost; #监听地址 #charset koi8-r; #access_log logs/host.access.log main; location ~ ^.*?/upload/[^/]*?$ { proxy_connect_timeout 15; proxy_send_timeout 15; proxy_read_timeout 15; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header connection ""; proxy_pass http://upload; #请求转向upload 定义的服务器列表 client_max_body_size 1024m; } } }
구성 후 구성 파일을 저장하고 nginx를 다시 시작하세요
[root@vw010001135067 nginx]# nginx -s reload
브라우저에서 업로드 프로젝트를 호출하여 성공했는지 확인하세요
그림과 같이 액세스할 수 있습니다. 프로젝트가 올바르게 완료되고 구성이 성공했습니다!
위 내용은 Linux에서 nginx를 설치하고 구성하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

NginXunit은 여러 프로그래밍 언어를 지원하고 동적 구성, 제로 다운 타임 업데이트 및 내장로드 밸런싱과 같은 기능을 제공하는 오픈 소스 응용 프로그램 서버입니다. 1. 동적 구성 : 다시 시작하지 않고 구성을 수정할 수 있습니다. 2. 다국어 지원 : Python, Go, Java, PHP 등과 호환됩니다. 3. 제로 다운 타임 업데이트 : 서비스를 중단하지 않는 응용 프로그램 업데이트를 지원합니다. 4. 내장로드 밸런싱 : 요청을 여러 응용 프로그램 인스턴스에 배포 할 수 있습니다.

NginxUnit은 다국어 프로젝트 및 동적 구성 요구 사항에 적합한 Apachetomcat, Gunicorn 및 Node.js 내장 HTTP 서버보다 낫습니다. 1) 여러 프로그래밍 언어를 지원하고, 2) 동적 구성 재 장전을 제공합니다. 3) 확장 성과 신뢰성이 높은 프로젝트에 적합한 내장로드 밸런싱 기능.

NginxUnit은 모듈 식 아키텍처 및 동적 재구성 기능으로 응용 프로그램 성능 및 관리 가능성을 향상시킵니다. 1) 모듈 식 설계에는 마스터 프로세스, 라우터 및 응용 프로그램 프로세스가 포함되어 효율적인 관리 및 확장을 지원합니다. 2) 동적 재구성을 통해 CI/CD 환경에 적합한 런타임시 구성을 완벽하게 업데이트 할 수 있습니다. 3) 다국어 지원은 언어 런타임의 동적로드를 통해 구현되어 개발 유연성을 향상시킵니다. 4) 고성능은 이벤트 중심 모델과 비동기 I/O를 통해 달성되며 높은 동시성에서도 효율적으로 유지됩니다. 5) 응용 프로그램 프로세스를 분리하고 응용 프로그램 간의 상호 영향을 줄임으로써 보안이 향상됩니다.

NginxUnit을 사용하여 여러 언어로 응용 프로그램을 배포하고 관리 할 수 있습니다. 1) nginxunit을 설치하십시오. 2) Python 및 PHP와 같은 다른 유형의 응용 프로그램을 실행하도록 구성하십시오. 3) 응용 프로그램 관리에 동적 구성 기능을 사용하십시오. 이러한 단계를 통해 응용 프로그램을 효율적으로 배포하고 관리하고 프로젝트 효율성을 향상시킬 수 있습니다.

Nginx는 높은 동시 연결을 처리하는 데 더 적합한 반면 Apache는 복잡한 구성 및 모듈 확장이 필요한 시나리오에 더 적합합니다. 1.NGINX는 고성능 및 낮은 자원 소비로 유명하며 높은 동시성에 적합합니다. 2. Aapache는 안정성과 풍부한 모듈 확장으로 유명하며 복잡한 구성 요구에 적합합니다.

NginxUnit은 동적 구성 및 고성능 아키텍처로 응용 프로그램 유연성 및 성능을 향상시킵니다. 1. 동적 구성을 사용하면 서버를 다시 시작하지 않고 응용 프로그램 구성을 조정할 수 있습니다. 2. 고성능은 이벤트 중심 및 비 블로킹 아키텍처 및 다중 프로세스 모델에 반영되며 동시 연결을 효율적으로 처리하고 멀티 코어 CPU를 활용할 수 있습니다.

Nginx와 Apache는 성능, 확장 성 및 효율성 측면에서 고유 한 장점과 단점을 가진 강력한 웹 서버입니다. 1) NGINX는 정적 컨텐츠를 처리하고 역전 프록시를 처리 할 때 잘 수행되며 동시 동시성 시나리오에 적합합니다. 2) Apache는 동적 컨텐츠를 처리 할 때 더 나은 성능을 발휘하며 풍부한 모듈 지원이 필요한 프로젝트에 적합합니다. 서버 선택은 프로젝트 요구 사항 및 시나리오에 따라 결정해야합니다.

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


핫 AI 도구

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

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

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

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

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

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음
