Nginx intall on Linux

2165 단어 Nginx설치 하 다.
1. 설치 의존
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

2. nginx 의 tar 가방 다운로드
//       
cd /usr/local
mkdir nginx
cd nginx
//  tar 
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz

3. nginx 설치
//  nginx  
cd /usr/local/nginx
//    
./configure
//  make  
make
//  make install  
make install

4. Nginx 상용 명령
//      
      /nginx/sbin/nginx -t
//    
      /nginx/sbin/nginx
//    
      /nginx/sbin/nginx -s stop
   : nginx -s quit
//    
      /nginx/sbin/nginx -s reload
//      
ps -ef | grep nginx
//    
kill -HUP Nginx    

5. 방화벽 설정
//       
sudo vim /etc/sysconfig/iptables
//       80  
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
//   
//     
sudo service iptables restart

6. Nginx 가상 도 메 인 이름 설정 및 테스트 검증
/  nginx.conf
sudo vim /usr/local/nginx/conf/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 centos;
worker_processes 1;
error_log /var/log/error.log;
pid /run/1nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
worker_rlimit_nofile 65535;
events {
    worker_connections 7000;
}

http {
    ########################################
    # ×¢ÊͲ¿·Ö
    # include /etc/nginx/sites-enabled/*;   
    ########################################

    ########################################
    # Ôö¼Ó²¿·Ö
    upstream myhost {
          server IP:7777 weight=1;
          server IP:7777 weight=1;
          server IP:7777 weight=1;
    }
    server {
            listen 8080;
            server_name   leo.com;
            location / {
                    proxy_pass http://leo;
            }
    }
    ########################################
}

7. Nginx 시작
//  nginx    
cd sbin
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx.conf

좋은 웹페이지 즐겨찾기