# 第二阶段模块二 **Repository Path**: old_he/module-2-of-the-second-stage ## Basic Information - **Project Name**: 第二阶段模块二 - **Description**: No description available - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-01-03 - **Last Updated**: 2021-01-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 搭建过程 ## Kafka Kafka的搭建是按照讲义里的步骤完成的,这里不再赘述。 ## Nginx 参照https://github.com/brg-liuwei/ngx_kafka_module/blob/master/README.md ``` git clone https://github.com/edenhill/librdkafka cd librdkafka ./configure make sudo make install ``` 下载Nginx ``` wget http://nginx.org/download/nginx-1.17.8.tar.gz tar -zxf nginx-1.17.8.tar.gz -C ../servers cd nginx-1.17.8 yum install gcc zlib zlib-devel openssl openssl-devel pcre pcre-devel -y ``` 安装ngx_kafka_module ``` git clone https://github.com/brg-liuwei/ngx_kafka_module # cd /path/to/nginx ./configure --add-module=/path/to/ngx_kafka_module make sudo make install # or, use `sudo make upgrade` instead of `sudo make install` ``` 配置Nginx ``` http { # some other configs kafka; kafka_broker_list 127.0.0.1:9092 127.0.0.1:9093; # host:port ... server { # some other configs location = /log { add_header 'Access-Control-Allow-Origin' $http_origin; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; kafka_topic topic_log; } } } ``` 启动Nginx ``` ./nginx ``` ## HTML 不太会写前端页面,网上找了一个,代码已上传。 把HTML放在Nginx配置对应的目录下就可以了。