nginx 支持udp配置

yum -y install proc* openssl* pcre*
 wget http://nginx.org/download/nginx-1.12.0.tar.gz
 tar zxvf nginx-1.12.0.tar.gz
 cd nginx-1.12.0
 ./configure  --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
 make
 make install

啓動nginx

/usr/sbin/nginxbash

 

重啓dom

/usr/sbin/nginx -s reloadcode

 

查看錯誤server

tail -f 200 /var/log/nginx/error.logip

 

#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;
}

stream {
    upstream udpserver {
      server 192.168.1.89:7346;
    }

    server {
      listen  192.168.1.89:2883 udp;
      proxy_responses 1;
      proxy_timeout 20s;
      proxy_pass udpserver;
    }
}
#同時支持http
http{
  server {
              listen       192.168.1.89:2345;
              location / {
                      proxy_pass http://192.168.1.89:8888;
                      proxy_set_header X-Real-IP $remote_addr;
              }
      }
}
相關文章
相關標籤/搜索