Linux下持续集成环境之Nginx环境搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/rzg813/article/details/80295808

Linux下持续集成环境之Nginx环境搭建(centos7)

文章来源:https://blog.csdn.net/omsvip/article/details/80295647


安装前置环境

1、安装c++编译环境:yum install -y make cmake gcc gcc-c++
2、安装依赖包

yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel

Nginx安装

安装包下载地址:wget http://nginx.org/download/nginx-1.10.2.tar.gz
解压后进入目录执行以下命令

./configure --prefix=/usr/local/nginx
make && make install

Nginx启动

    快速停止:cd /usr/local/nginx/sbin && ./nginx -s stop
    完整停止(建议使用):cd /usr/local/nginx/sbin && ./nginx -s quit
    先停止再启动(建议使用):cd /usr/local/nginx/sbin && ./nginx -s quit && ./nginx
    重新加载配置文件:cd /usr/local/nginx/sbin && ./nginx -s reload

    加载有问题:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

Nginx之Jenkinx代理设置

server {
    listen       80;
    server_name  jenkins.xxx.com;

    location / {
        proxy_pass http://127.0.0.1:9090;
        proxy_read_timeout  90;
            proxy_set_header X-Forwarded-Host $host:$server_port;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr; 
    }
}

Nginx之nexus代理设置

server {
    listen       80;
    server_name  maven.xxx.com;

    location / {
        proxy_pass http://maven.xxx.com:9091; 
    }
}

Nginx之html代理设置

server {
    listen       80;
    server_name  xxx.net www.xxx.net;

    location / {
        root   /home/www/xxx;
        index  index.html index.htm;
    }
}

Nginx之tomcat代理设置

server {
    listen       80;
    server_name  api.xxx.com;

    location / {
        proxy_pass http://127.0.0.1:8080; 
    }
}

Nginx之默认代理设置

server {
    listen       80;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {      
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:8080;
    #    fastcgi_index  index;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}
}

文章来源:

上篇文章地址:https://blog.csdn.net/omsvip/article/details/80295338

展开阅读全文

没有更多推荐了,返回首页