nginx配置
作者:互联网
启动tomcat sh ./xx/xx/startup.sh
vi /etc/sysconfig/network-scripts/
yum -y install gcc gcc-c++ autoconf automake
依赖第三方库gzip--zlib/rewrite--pcre/ssl---openssl
可以用yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel命令下载安装依赖库
安装方式
以此执行tar zxvf nginx-0.x.xx.tar.gz-------cd nginx-xxx-----.configure ---- make --- sudo make install
启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
停止nginx
将nginx添加到服务中
直接复制nginx 文件到/etc/init.d/
加入开机启动
vi /etc/rc.local
在文件加入一行/etc/init.d/nginx start
ps -ef|grep nginx
kill -quit nginx 主进程号
或kill -term nginx 主进程号(快速)
或kill -ini nginx 主进程号
或pkill -9 nginx (强制)
杀掉相关进程 前面命令的输出结果(PID)作为杀掉参数xargs kill -s 9
重启nginx
kill -hup nginx 主进程号
{
server 10.0.1.50:8080;
server 10.0.1.51:8080;
}
server
{
listen 80;
server_name www.linuxidc.com;
location / {
proxy_pass http://mynginx;
#Proxy Settings
proxy_redirect off;#是否跳转
proxy_set_header Host $host; #请求要转发的host
proxy_set_header X-Real-IP $remote_addr;#请求的远程地址 这些在浏览器的header都可看,不一一解释
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_max_temp_file_size 0;
proxy_connect_timeout 90; #连接前面的服务器超时时间
proxy_send_timeout 90;#请求转发数据报文的超时时间
proxy_read_timeout 90;#读取超时时间
proxy_buffer_size 4k; # 缓冲区的大小
proxy_buffers 4 32k; #
proxy_busy_buffers_size 64k; # #proxy_buffers缓冲区,网页平均在32k以下的
proxy_temp_file_write_size 64k; ##高负荷下缓冲大小(proxy_buffers*2)
}
nginx代理两个项目使用一个端口访问
upstream server_transfer{
server 127.0.0.1:8086;
}
upstream server_local{
server 127.0.0.1:8080;
}
server {
listen 8083;
server_name localhost;
location /transfer/ {
proxy_pass http://server_transfer/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
location / {
proxy_pass http://server_local/;
proxy_set_header Host $host;
#proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
讲tomcat得启动端口改成9999<Connector port="8080->9999" protocol="HTTP/1.1 connectionTimeout="20000" redirectPort="8443" />
查看集群进程
ps aux | grep zookeeper
测试zookeeper启动成功
./zkCli.sh -server192.168.100.5:2181
zookeeper的日志文件名称zookeeper.out
配置时在conf/zoo.cfg文件中配置的server.x=xxx.xxx.xxx只能是本机的地址
如果配置几个实例可以用不同的端口
在zookeeper的dataDir里边需要创建一个myid文件里边写实例id(即server.x的x必须时数字)、
安装sbt
curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo
sudo mv bintray-sbt-rpm.repo /etc/yum.repos.d/
sudo yum install sbt
更新sbt
./sbt update
./sbt package
./sbt assembly-package-dependency
访问
启动kafka
JMX_PORT=9997 /usr/helpdevelop/kafka/bin/kafka-server-start.sh /usr/helpdevelop/kafka/config/server.properties &
标签:set,sbt,header,配置,server,nginx,proxy 来源: https://www.cnblogs.com/sxshe/p/13943258.html