Alibaba Cloud의 CentOS6.5 시스템에 Nginx 설치

WBOY
풀어 주다: 2016-08-08 09:32:00
원래의
1056명이 탐색했습니다.

1. 패키지 형태로 설치

설치방법

시스템 환경 : CentOS-6.5

소프트웨어: nginx-1.6.2.tar.gz
설치 방법: 소스 코드 컴파일 및 설치
설치 위치: /opt/program/nginx- 1.6.2
다운로드 주소: http://nginx.org/en/download.html

설치 전제조건

nginx를 설치하기 전에 g++, gcc, openssl을 확인해야 합니다. -devel, pcre-devel 및 zlib-devel 소프트웨어. 필요한 소프트웨어 설치:

# yum install gcc-c++

# yum install gcc-c++
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
# 찾기 - 이름 nginx
#  find -name nginx
./nginx
./nginx/sbin/nginx
./nginx-1.2.6/objs/nginx
./nginx./nginx/sbin/nginx

./nginx-1.2.6/objs/nginx

시스템에 설치된 Nginx 확인:

# yum remove nginx
원래 Nginx 제거

설치

설치 패키지 파일을 /opt/software에 업로드하고 실행합니다. 다음 작업:

# cd /opt/program
# mkdir nginx
# tar -zxvf ../software/nginx-1.6.2.tar.gz
# cd nginx-1.6.2
# ./configure --prefix=/opt/program/nginx     注:处此是指定nginx的安装目录,大多用户习惯于安装在/usr/local/nginx下面
# make                编译
# make install    安装
# cd /opt/program

# mkdir nginx

# tar -zxvf ../software/nginx-1.6.2.tar.gz
#修改防火墙配置: 
# vi + /etc/sysconfig/iptables
#添加配置项 
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#重启防火墙 
# service iptables restart
# cd nginx-1.6.2

# ./configure --prefix=/opt/program/nginx 참고: nginx를 지정하기 위한 설치 디렉터리입니다. 대부분의 사용자는 /usr/local/nginx# make Compile# make install 설치

#方法1

# /opt/program/nginx/sbin/nginx -c /opt/program/nginx/sbin/nginx/conf/nginx.conf
#方法2
# /opt/program/nginx/sbin/nginx

구성: 이 단계를 실행하지 않았으며 외부에서도 접근 가능합니다. #방화벽 구성 수정:

#查询nginx主进程号 

ps -ef | grep nginx
#停止进程 
kill -QUIT 主进程号 
#快速停止 
kill -TERM 主进程号 
#强制停止 
pkill -9 nginx

# vi + /etc/ sysconfig/iptables

#구성 항목 추가 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

# /opt/program/nginx/sbin/nginx -s reload

#방화벽 다시 시작

# 서비스 iptables 재시작

시작

#测试端口 

netstat –na|grep 80
#浏览器中测试 
http://ip:80

tr> table>중지
#방법 1# /opt/program/nginx/ sbin/nginx -c /opt/ 프로그램/nginx/sbin/nginx/conf/nginx.conf#방법 2# /opt/program/nginx/sbin/nginx
#nginx 기본 프로세스 번호 쿼리 ps -ef | grep nginx#프로세스 중지 kill - QUIT 주 프로세스 번호 #Quick Stop kill -TERM 주 프로세스 번호 #Force stop pkill -9 nginx
다시 시작# /opt/program/nginx/sbin/nginx -s 다시 로드 테스트#테스트 포트 netstat –na|grep 80# 브라우저에서 테스트 http://ip:80

이중, 以yum적방式安装

一、直接通过yum安装

# yum list | grep nginx

# yum -y install nginx 

二、下载rpm包安装 php,nginx

# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm 

# yum -y install nginx  

# yum -y php-fpm  

# service php-fpm restart  

# service nginx restart  

# chkconfig php-fpm on  设置开机自动启动 

# chkconfig nginx on  设置开机自动启动 

# netstat -lntp | grep nginx  查看端口

一、直接通过yum安装

# yum 목록 | grep nginx

# yum -y install nginx 

2、下载rpm包安装 php,nginx

# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm 

# yum -y nginx 설치  # yum -y php-fpm  # 서비스 php-fpm 다시 시작  # 서비스 nginx 다시 시작  # chkconfig php-fpm on  设置开机自动启动 # chkconfig nginx on  设置开机自动启动 # netstat -lntp | grep nginx  查看端口
参考网址: http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html 以上就介绍了阿里云上CentOS6.5系统安装Nginx, 包括了方容, 希望对PHP教程兴趣的朋友有所帮助.

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!