링크 ux 아래 nginx 설치, 조작, 설정, 문제 및 해결

3253 단어 nginx
-----------------------------------------------  --------------------------------------------------------
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
nginx    :https://nginx.org/download/

--  
tar -zxvf nginx-1.9.9.tar.gz      tar -zxvf nginx-1.9.9.tar.gz -C /home/nginx
--  nginx  
cd nginx-1.9.9
--  
./configure --prefix=/usr/local/nginx
--make
make
make install
--         /usr/local/nginx   
./sbin/nginx -t

---          (     )
--  80  :
firewall-cmd --add-port=80/tcp --permanent
#     
systemctl restart firewalld

--  nginx     
vim /etc/rc.d/rc.local
       /usr/local/nginx/sbin/nginx


----------------------------------------------nginx    ---------------------------------------------------
 nginx      
--       Nginx:./nginx -s stop
--       Nginx:./nginx -s quit
--           :nginx -s reload


-------------------------------  nginx       (    nginx)-----------------------------------------
--  nginx
  service nginx stop
--  nginx    
  chkconfig nginx off
--     Nginx (whereis nginx)
        rm -rf /usr/sbin/nginx
        rm -rf /etc/nginx
        rm -rf /etc/init.d/nginx
--   yum  
  yum remove nginx

---------------------------------------conf       --------------------------------------------------------
   nginx     conf/nginx.conf 
--     
    #test1                ,hash       
    upstream test1sss {
      server localhost:8090; #       tomcat1(  )
    }
    #test2
    upstream test2sss {
      server localhost:8091; #       tomcat2(  )
    }

server {
    #   80  
    listen       80;
    server_name  www.pytest1.xxx.com pytest1.xxx.com;
    access_log on;
    #charset koi8-r;
     charset utf-8;
    #             
    autoindex on;
    #access_log  logs/host.access.log  main;

    location /test1 {
            proxy_pass http://test1sss/;
            proxy_set_header  Host  $host;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    # 
    location /test2 {
            proxy_pass http://test2sss/;
            proxy_set_header  Host  $host;
            proxy_connect_timeout 5s;
    }

    location / {
       root html;
       index index.html index.htm;
    }
    #        /home/dist1
    location /dist1 {
       alias /home/dist1/;
       index index.html index.htm;
    }
    #        /home/dist2/dist2
    location /dist2 {
       root /home/dist2/;
       index index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

 -----    
  upstream backend {
    server backend1.example.com       weight=5;
    server backend2.example.com:8080;
    server unix:/tmp/backend3;

    server backup1.example.com:8080   backup;
    server backup2.example.com:8080   backup;
  }

  
------------------------------logs   nginx pid        -------------------------------------------
    nginx      logs  pid  
  ps -ef | grep nginx
--  logs     
  touch nginx.pid
--     
 echo "34222" > nginx.pid
--     :
 ./nginx -s reload

docker 에 nginx 를 설치 하 는 것 은 개인 적 으로 귀 찮 기 때문에 일반적인 상황 에서 설치 패 키 지 를 미리 다운로드 하여 Liux 에 직접 설치 하 는 방식 을 선택 합 니 다. 글 은 참고 만 하고 구체 적 인 설치 방식 도 구체 적 인 상황 에 따라 정할 수 있 습 니 다.

좋은 웹페이지 즐겨찾기