phppgadmin in nginx

nginx的安装参考

http://blog.163.com/digoal@126/blog/static/163877040201461822210354/

nginx的使用参考文档

http://nginx.org/en/docs/

本文讲一下phppgadmin 和 mediawiki两个虚拟服务器, 使用不同的端口的配置.

mediawiki 的搭建参考

http://blog.163.com/digoal@126/blog/static/163877040201461391320568/

下载phppgadmin, 解压到站点目录.

# wget https://github.com/phppgadmin/phppgadmin/tarball/master

# mv master phpPgAdmin-snapshot.tar.gz
# tar -zxvf phpPgAdmin-snapshot.tar.gz
# cd phppgadmin-phppgadmin-ca302af/

配置phppgadmin : 

# cd conf/
[root@dba conf]# ll
total 8
-rw-rw-r-- 1 root root 6409 Jul 21 07:43 config.inc.php-dist
[root@dba conf]# cp config.inc.php-dist config.inc.php
[root@dba conf]# vi config.inc.php
<?php

        /**
         * Central phpPgAdmin configuration.  As a user you may modify the
         * settings here for your particular configuration.
         *
         * $Id: config.inc.php-dist,v 1.55 2008/02/18 21:10:31 xzilla Exp $
         */

        // An example server.  Create as many of these as you wish,
        // indexed from zero upwards.

        // Display name for the server on the login screen
        $conf['servers'][0]['desc'] = 'PostgreSQL9.3.3';

        // Hostname or IP address for server.  Use '' for UNIX domain socket.
        // use 'localhost' for TCP/IP connection on this computer
        $conf['servers'][0]['host'] = '172.16.3.150';

        // Database port on server (5432 is the PostgreSQL default)
        $conf['servers'][0]['port'] = 5432;

        // Database SSL mode
        // Possible options: disable, allow, prefer, require
        // To require SSL on older servers use option: legacy
        // To ignore the SSL mode, use option: unspecified
        $conf['servers'][0]['sslmode'] = 'disable';

        // Change the default database only if you cannot connect to template1.
        // For a PostgreSQL 8.1+ server, you can set this to 'postgres'.
        $conf['servers'][0]['defaultdb'] = 'template1';

        // Specify the path to the database dump utilities for this server.
        // You can set these to '' if no dumper is available.
        $conf['servers'][0]['pg_dump_path'] = '/opt/pgsql/bin/pg_dump';
        $conf['servers'][0]['pg_dumpall_path'] = '/opt/pgsql/bin/pg_dumpall';

        // 多个postgresql cluster的话, 序列增加即可. 如$conf['servers'][1]['host'] = ''.....

        // Example for a second server (PostgreSQL for Windows)
        //$conf['servers'][1]['desc'] = 'Test Server';
        //$conf['servers'][1]['host'] = '127.0.0.1';
        //$conf['servers'][1]['port'] = 5432;
        //$conf['servers'][1]['sslmode'] = 'allow';
        //$conf['servers'][1]['defaultdb'] = 'template1';
        //$conf['servers'][1]['pg_dump_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dump.exe';
        //$conf['servers'][1]['pg_dumpall_path'] = 'C:\\Program Files\\PostgreSQL\\8.0\\bin\\pg_dumpall.exe';

        /* Groups definition */
        /* Groups allow administrators to logicaly group servers together under
         * group nodes in the left browser tree
         *
         * The group '0' description
         */
        //$conf['srv_groups'][0]['desc'] = 'group one';

        /* Add here servers indexes belonging to the group '0' seperated by comma */
        //$conf['srv_groups'][0]['servers'] = '0,1,2';

        /* A server can belong to multi groups. Here server 1 is referenced in both
         * 'group one' and 'group two'*/
        //$conf['srv_groups'][1]['desc'] = 'group two';
        //$conf['srv_groups'][1]['servers'] = '3,1';

        /* A group can be nested in one or more existing groups using the 'parents'
         * parameter. Here the group 'group three' contains only one server and will
         * appear as a subgroup in both 'group one' and 'group two':
         */
        //$conf['srv_groups'][2]['desc'] = 'group three';
        //$conf['srv_groups'][2]['servers'] = '4';
        //$conf['srv_groups'][2]['parents'] = '0,1';

        /* Warning: Only groups with no parents appears at the root of the tree. */

        /* You can apply specific theme depending on servers, users and databases
         * The priority order is :
         *   * the theme defined for a server
         *   * the theme defined for a database apply over the server one
         *   * the theme defined for a user apply over the database one
         */
        /* Example for servers */
        //$conf['servers'][0]['theme']['default'] = 'default';
        /* Example for users */
        //$conf['servers'][0]['theme']['user']['specific_user'] = 'default';
        /* Example for databases */
        //$conf['servers'][0]['theme']['db']['specific_db'] = 'default';

        // Default language. E.g.: 'english', 'polish', etc.  See lang/ directory
        // for all possibilities. If you specify 'auto' (the default) it will use
        // your browser preference.
        $conf['default_lang'] = 'auto';

        // AutoComplete uses AJAX interaction to list foreign key values
        // on insert fields. It currently only works on single column
        // foreign keys. You can choose one of the following values:
        // 'default on' enables AutoComplete and turns it on by default.
        // 'default off' enables AutoComplete but turns it off by default.
        // 'disable' disables AutoComplete.
        $conf['autocomplete'] = 'default on';

        // If extra login security is true, then logins via phpPgAdmin with no
        // password or certain usernames (pgsql, postgres, root, administrator)
        // will be denied. Only set this false once you have read the FAQ and
        // understand how to change PostgreSQL's pg_hba.conf to enable
        // passworded local connections.
        $conf['extra_login_security'] = true;
        // 如果要使用pgsql, postgres, root, adminstrator等用户名登陆, 必须设置为false.

        // Only show owned databases?
        // Note: This will simply hide other databases in the list - this does
        // not in any way prevent your users from seeing other database by
        // other means. (e.g. Run 'SELECT * FROM pg_database' in the SQL area.)
        $conf['owned_only'] = false;

        // Display comments on objects?  Comments are a good way of documenting
        // a database, but they do take up space in the interface.
        $conf['show_comments'] = true;

        // Display "advanced" objects? Setting this to true will show
        // aggregates, types, operators, operator classes, conversions,
        // languages and casts in phpPgAdmin. These objects are rarely
        // administered and can clutter the interface.
        $conf['show_advanced'] = false;

        // Display "system" objects?
        $conf['show_system'] = false;

        // Minimum length users can set their password to.
        $conf['min_password_length'] = 1;

        // Width of the left frame in pixels (object browser)
        $conf['left_width'] = 200;

        // Which look & feel theme to use
        $conf['theme'] = 'default';

        // Show OIDs when browsing tables?
        $conf['show_oids'] = false;

        // Max rows to show on a page when browsing record sets
        $conf['max_rows'] = 30;

        // Max chars of each field to display by default in browse mode
        $conf['max_chars'] = 50;

        // Send XHTML strict headers?
        $conf['use_xhtml_strict'] = false;

        // Base URL for PostgreSQL documentation.
        // '%s', if present, will be replaced with the PostgreSQL version
        // (e.g. 8.4 )
        $conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/';

        // Configuration for ajax scripts
        // Time in seconds. If set to 0, refreshing data using ajax will be disabled (locks and activity pages)
        $conf['ajax_refresh'] = 3;

        /** Plugins management
         * Add plugin names to the following array to activate them
         * Example:
         *   $conf['plugins'] = array(
         *     'Example',
         *     'Slony'
         *   );
         */
        $conf['plugins'] = array();

        /*****************************************
         * Don't modify anything below this line *
         *****************************************/

        $conf['version'] = 19;

?>

移动到站点目录 : 

# mv phppgadmin-phppgadmin-ca302af /site/phppgadmin

配置nginx, 新增一个server, 监听另一个端口. php使用fastcgi代理.

# vi nginx.conf
    server {
        listen       0.0.0.0:8001;
        server_name  dba.sky-mobi.com;
        root /site/phppgadmin;
        location / {
            index  index.php index.html index.htm;
        }
        location ~ \.php$ {
                include /opt/nginx1.6.0/conf/fastcgi_params;
                fastcgi_pass   127.0.0.1:9000;   # php-fpm的监听
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }

重载nginx.

nginx -s reload

在目标数据库创建一个普通用户, 用于登陆, 因为前面我们设置了不允许超级用户postgres 登陆.

digoal=# create role digoal nosuperuser login encrypted password 'digoal321';
CREATE ROLE
pg93@db-172-16-3-150-> cd $PGDATA
pg93@db-172-16-3-150-> vi pg_hba.conf
host all digoal 0.0.0.0/0 md5

打开浏览器, 输入URL即可 : 

http://dba.sky-mobi.com:8001/

[参考]

1. http://phppgadmin.sourceforge.net/doku.php?id=faq_docs

2. http://nginx.org/en/docs/

3. https://raw.githubusercontent.com/phppgadmin/phppgadmin/master/INSTALL

4. http://blog.163.com/digoal@126/blog/static/163877040201461822210354/

5. http://nginx.org/en/docs/

6. http://blog.163.com/digoal@126/blog/static/163877040201461391320568/

时间: 2024-08-03 13:43:24

phppgadmin in nginx的相关文章

nginx proxy_pass &amp; rewrite exp.

昨天新建的一个站点, phppgadmin, 用于连接pg-xl, greenplum, postgresql , 作为一个数据库demo站点. 参考 http://blog.163.com/digoal@126/blog/static/163877040201462235618643/ 原来的做法是新建一个server, server_name和dba.sky-mobi.com相同, 新增一个监听端口8001来区分这个server和老的80端口所在的wiki站点. 这样的话访问db demo站

nginx中如何限制下载和并发速度

1.添加limit_zone(这个变量只能在http协议使用) 2.编辑nginx.conf文件 向其中添加limit_zone one $remote_addr 10m指令,然后添加limit_conn,由于这个变量在http.server.location段使用,而且只限制一个站点,所以添加到server里面即可 http://wiki.nginx.org/NginxHttpLimitZoneModule 下载limit_zone http://wiki.nginx.org/NginxHtt

利用awstats分析nginx日志

今天打算分析下nginx日志,要分析nginx日志,我们可以通过shell脚本和第三方软件awstats进行分析,在此我们选择的是通过第三方软件awstats进行分析. 要使用awstats分析nginx日志,我们要安装awstats,而在安装awstats之前,我们需要先来介绍下awstats是什么? 一.awstats是什么 awstats是一个免费非常简洁而且强大有个性的基于Perl语言的WEB日志分析工具. 它可以统计网站的如下信息: 1):访问量.访问次数.页面浏览量.点击数.数据流量

切割nginx日志

这几天自己看了下博客的nginx日志,发现日志文件发现越来越大. 因为nginx自己不会对日志文件进行切割,所以打算通过其他方式进行切割,而且为了后续能对nginx日志文件里面记录的数据进行分析,所以打算按照天对其进行切割. PS:本篇文章所以的操作是在centos6.5 OS 64bit上进行. 切割nginx日志,我们可以通过两种不同的方式进行,分别是:通过logrotate和通过shell脚本. 如果是yum方式安装的nginx,系统默认会自动通过logrotate这个日志管理软件,按天进

断点续传-请问perl是否可以改写nginx服务器得到的POST请求地址,并且不能丢失post的数据

问题描述 请问perl是否可以改写nginx服务器得到的POST请求地址,并且不能丢失post的数据 场景:后端JAVA应用作了一个断点续传的功能,测试OK,由于一些环境限制原因,前端必须用nginx转发.坑爹的是nginx的rewrite功能会把post请求变为get请求,如果使用 proxy pass则会出现如果用户上传中断,nginx不会把已经上传的东西扔给后端应用 现在考虑方向是改写post请求的链接(改成IP加端口)但是不更改别的东西,比如post的数据,方法等等,或者干脆收到此种请求

Nginx 内置变量,细化规则,真实IP获取及限制连接请求

希望下周测试之后能用起来!!!感觉很有用的. http://www.bzfshop.net/article/176.html http://www.cr173.com/html/19761_1.html http://blog.pixelastic.com/2013/09/27/understanding-nginx-location-blocks-rewrite-rules/ 你 Google 不到的配置   很多时候,我们的网站不是简单的  普通用户IE浏览器  --->  你的服务器  的

Own your own shit —— 从 NGINX 日志滚动说起

最近我开始接管一个应用 T,然而我并不是接管应用 T 的开发工作,而是搞一个新的应用 Q 来取代它,但是在 T 下线之前,我得做一些日常运维的工作让 T 能够正常工作下去. 也许是我刚刚成为 T 的 AppOps 的缘故,一时半会系统数据没来得及同步,T 的各种告警还没发到我这里.但是没告警不代表没问题呀,突然间旺旺响起,同事告知某分组下面的机器磁盘都快满了. 于是我赶紧申请了权限登录机器处理.按照之前的经验,磁盘满这种事情,不外乎日志打多了,大促之前我们的例行公事就是把应用集群的过往日志全给删

如何查看Nginx,Apache,lighttpd,Mysql和Php的编译参数

查看一些常见服务的在编译安装时的参数: 1.Nginx 编译安装时的参数 [root@test ~]#/usr/local/nginx/sbin/nginx -V nginx version: nginx/0.7.65 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48) TLS SNI support disabled configure arguments: --user=www --group=www --prefix=/usr/local/ngin

Nginx启动/停止/状态检查/重新启动/平滑重启脚本

默认使用源代码安装Nginx时,Ngninx需要另外配置启动/停止/状态检查/ 重新启动/平滑重启/测试配置文件等功能的脚本,风信网收集并整理了一段Nginx的功能脚本,供大家参考使用. 应用新脚本之前,需要先运行命令关闭nginx [root@localhost ~]# sudo kill `cat /usr/local/nginx/logs/nginx.pid` #请修改为你的nginx.pid文件路径 建立一个nginx启动脚本 [root@localhost ~]# vi /etc/in