링크 ux 배포 nginx

3981 단어 nginx
1. 의존 팩 설치
# yum install gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl openssl-devel kernel-devel  popt-devel libnl libnl-devel libnfnetlink-devel wget 

2. 다운로드 경로 만 들 기
# mkdir /home/setup #  setup  (        )        
# cd /home/setup #   setup   
# wget http://nginx.org/download/nginx-1.17.2.tar.gz #  

3. nginx 설치
# tar -zxvf nginx-1.17.2.tar.gz #  
#cd nginx-1.17.2 #    
#useradd www -M -s /sbin/nologin #  www  ,  -M           ,-s      shell  
 # vi auto/cc/gcc  #         Debug        179 
----------------  
#CFLAGS="$CFLAGS -g"
----    

4. nginx 컴 파일 (프로젝트 필요 에 따라 컴 파일 대응 확장)
# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_flv_module --with-http_mp4_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-mail
#make && make install #  
#echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local #      
#mkdir /home/nginx 
#mkdir /home/nginx/conf  #nginx      
#chmod -R a+x /home/nginx/conf #      
 :               
 :web.conf chmod -R a+x /home/nginx/conf/web.conf

5. nginx. conf 설정
############################################# nginx.conf
user  www www;
worker_processes  4;     #cpu  1/2
error_log  /var/log/ngerror.log;   #    
worker_rlimit_nofile 65536;
events {
    worker_connections  4096;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    charset utf-8;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                     '"$http_user_agent" "$http_x_forwarded_for"';
  
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    keepalive_timeout  65;
    client_max_body_size 1000M;    #      
    fastcgi_connect_timeout 3000;
    fastcgi_send_timeout 3000;
    fastcgi_read_timeout 3000;
    fastcgi_buffer_size 256k;
    fastcgi_buffers 8 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
    #proxy_buffer_size  128k;    #  
    #proxy_buffers   32 32k;    #  
   # proxy_busy_buffers_size 128k;    #  
    #proxy_temp_file_write_size 128k;  #  
    #proxy_cache_path /var/www/cache levels=1:2 keys_zone=mycache:20m max_size=2048m inactive=60m;  #  
    #proxy_temp_path /var/www/cache/tmp;  #  
    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 9;
    gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php;
    gzip_vary on;
    ## includes vhosts
    include /usr/local/nginx/*.conf;
    include /home/nginx/conf/*.conf;
}
##############################################

6. nginx 시작
  nginx
#/usr/local/nginx/sbin/nginx
  nginx 
#/usr/local/nginx/sbin/nginx -s reload
  nginx
#/usr/local/nginx/sbin/nginx -s stop


7. 테스트 사이트
  • 웹. conf 설정
  • #cd /home/nginx/conf #    
    #vi web.conf #     thinkphp   
    #################################################  
    server {
    listen 80;  #  80
    server_name all; #    IP
    root /home/web; #    
    # access_log /home/nginx/logs/access.log; #      
    # error_log /home/nginx/logs/error.log; #      
    index index.html index.htm;   #    
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp)$ {
    expires 100d;
    }
    location ~ .*\.(js|css)?$ {
    expires 30d;
    }
    error_page 500 502 503 504 /50x.html;
    }
    --------------------------------    
    

    2) 웹 사이트 만 들 기
    #mkdir /home/web
    #cd /home/web
    #vi index.html
    --------------  
          !!!
    -----------  
    
      nginx  
    #/usr/local/nginx/sbin/nginx -s reload
    

    3) 액세스 테스트
    #curl http://ip
    #      !!!
    

    OK 성공

    좋은 웹페이지 즐겨찾기