puppet使用 apache passsenger 作为前端 (centos)

简介:

概要

使用 nginx + passenger 作为puppet master 的前端

nginx + passenger 配置

package 安装

通过 gem 的方式来安装 passenger,

# gem install rake rack passenger --no-rdoc --no-ri

安装完成之后, nginx 不能直接从 yum 的源来安装, 用下面的命令来安装,
这样安装的 nginx 中就包含了 passenger 模块.

root@master-2:~# passenger-install-nginx-module
# 根据提示完成安装, 中途可能会提示用 apt-get 安装一些缺失的包.
# 安装完缺失的包后, 再次执行 passenger-install-nginx-module 即可.
# 安装 nginx 之前, 会有如下选择
Do you want this installer to download, compile and install Nginx for you?

 1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 1.6.2 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

 2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx's
    'configure' script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the 'configure' script according to your
    instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort: 1

# 根据情况, 如果熟悉的话, 可以选择2, 否则选择1 即可自动编译安装 nginx

配置文件设置

nginx 配置文件 nginx.conf

# cat /etc/nginx/conf/nginx.conf

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


http {
    passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-4.0.57;
    passenger_ruby /usr/bin/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    include /etc/nginx/conf.d/*.conf;
    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

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

    }
}

nginx中作为puppet前端的配置.

# cat /etc/nginx/conf.d/puppetserver.conf
server {
  listen                     8140 ssl;
  server_name                puppet-server puppet-server.yunji.com;

  passenger_enabled          on;
  passenger_set_cgi_param    HTTP_X_CLIENT_DN $ssl_client_s_dn;
  passenger_set_cgi_param    HTTP_X_CLIENT_VERIFY $ssl_client_verify;

  access_log                 /var/log/nginx/puppet_access.log;
  error_log                  /var/log/nginx/puppet_error.log;

  root                       /usr/share/puppet/rack/puppetmasterd/public;

  ssl_certificate            /var/lib/puppet/ssl/certs/puppet-server.yunji.com.pem;
  ssl_certificate_key        /var/lib/puppet/ssl/private_keys/puppet-server.yunji.com.pem;
  ssl_crl                    /var/lib/puppet/ssl/ca/ca_crl.pem;
  ssl_client_certificate     /var/lib/puppet/ssl/certs/ca.pem;
  ssl_ciphers                SSLv2:-LOW:-EXPORT:RC4+RSA;
  ssl_prefer_server_ciphers  on;
  ssl_verify_client          optional;
  ssl_verify_depth           1;
  ssl_session_cache          shared:SSL:128m;
  ssl_session_timeout        5m;
}

rack 目录生成

centos 不像 debian, 没有自动生成 puppetmasterd 的 rack 目录.

[root@puppet-server ~]# cd /usr/share/puppet
[root@puppet-server puppet]# mkdir -p rack/puppetmasterd/public
[root@puppet-server puppet]# mkdir -p rack/puppetmasterd/tmp
[root@puppet-server puppet]# cp ext/rack/config.ru rack/puppetmasterd/
[root@puppet-server puppet]# chown puppet:puppet rack/puppetmasterd/config.ru
标签:  puppet


本文转自wang_yb博客园博客,原文链接:http://www.cnblogs.com/wang_yb/p/4247937.html,如需转载请自行联系原作者

目录
相关文章
|
5月前
|
Web App开发 JavaScript 前端开发
从脚手架开始学前端 【第3期】Node.js环境搭建(CentOS 7)
从脚手架开始学前端 【第3期】Node.js环境搭建(CentOS 7)
106 0
|
5月前
|
Linux 网络安全 Apache
Centos下操作Apache httpd
Centos下操作Apache httpd
117 0
|
5月前
|
前端开发 jenkins 持续交付
新的centos7.9安装docker版本的jenkins2.436.1最新版本-前端项目发布(五)
新的centos7.9安装docker版本的jenkins2.436.1最新版本-前端项目发布(五)
151 1
|
网络协议 Linux 应用服务中间件
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
200 0
|
2月前
|
安全 Linux 网络安全
如何在 CentOS 7 上为 Apache 创建 SSL 证书
如何在 CentOS 7 上为 Apache 创建 SSL 证书
43 0
|
2月前
|
前端开发 小程序 Unix
Centos安装前端开发常用软件
Centos安装前端开发常用软件
|
2月前
|
安全 Java 应用服务中间件
在CentOS 7上安装Apache Tomcat 8的方法
在CentOS 7上安装Apache Tomcat 8的方法
67 0
|
2月前
|
安全 Java 应用服务中间件
如何通过 Yum 在 CentOS 7 上安装 Apache Tomcat 7
如何通过 Yum 在 CentOS 7 上安装 Apache Tomcat 7
120 0
|
2月前
|
关系型数据库 MySQL Linux
在 CentOS 7 服务器上安装和保护 phpMyAdmin 与 Apache 的方法
在 CentOS 7 服务器上安装和保护 phpMyAdmin 与 Apache 的方法
45 0
下一篇
无影云桌面