1.安装 Java jdk
yum -y install java-1.8.0-openjdk-devel.x86_64
2.安装nginx
yum -y install nginx
3.配置 nginx主文件
vi /etc/nginx/nginx.conf
写入下面内容
user nginx;
worker_processes  8;   ###线程数
worker_cpu_affinity auto;
worker_rlimit_nofile 65535; 
pid        /var/run/nginx.pid;
events {
    use  epoll;
    worker_connections  65535;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
     log_format mains $server_name "|" $remote_addr "|" [$time_iso8601] "|" "$request"  "|"
$status  "|" $body_bytes_sent "|"  "$http_referer"   "|"
"$http_user_agent"  "|"  $upstream_addr "|" $request_time   "|" $upstream_response_time|;
   client_max_body_size 100M;
   client_body_buffer_size 1024k;
   client_header_buffer_size 32k;
   sendfile        on;
   gzip on;
   tcp_nopush     on;
   keepalive_timeout  300;
   proxy_connect_timeout    300;
   proxy_send_timeout     300;
   proxy_read_timeout     300;
   proxy_ignore_client_abort on;
   gzip_min_length 1k;
   gzip_buffers 4 16k;
   gzip_comp_level 2;
   gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
   gzip_disable "MSIE [1-6]\."; 
   gzip_vary off;
   include /etc/nginx/conf.d/http/*.conf;    ### 子配置文件
    }4.新建include子配置文件
mkdir -p /etc/nginx/conf.d/http/
vi wangye.conf写入以下配置
upstream  order1{
server 192.168.112.133:8080;   ###代理服务器地址 可以多个
}
server {
listen 80;   ###端口号
####代理域名 server_name  wwww.****.com
server_name jd.3rfwe.top;
access_log /tmp/1.log  mains;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Scheme  $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://order1;  ###这里的order1必须跟 上面的upstream 后面的名字相同
}
}
5.放入代码包
java -jar 代码包名字 ####前台启动
nohup java -jar 代码包名字 & ########后台启动
netstat -lnntup|grep 8000 ###查看端口
kill -9 进程号 #强制杀掉进程
ps -ef|grep nginx #查看进程










