phppgadmin in nginx

本文涉及的产品
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
云原生数据库 PolarDB MySQL 版,通用型 2核8GB 50GB
简介:
nginx的安装参考
nginx的使用参考文档
本文讲一下phppgadmin 和 mediawiki两个虚拟服务器, 使用不同的端口的配置.
mediawiki 的搭建参考

下载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即可 : 

[参考]
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍如何基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
移动开发 JavaScript 前端开发
使用 JavaScript 进行跨域请求
使用 JavaScript 进行跨域请求
254 1
|
7月前
|
人工智能 自然语言处理 监控
阿里云ModelScope平台的综合测评
ModelScope是阿里云推出的AI模型全生命周期管理平台,涵盖模型开发、训练、部署及评测全流程。其核心功能包括预训练模型库、一键式训练与部署、模型版本管理等。中文竞技场作为子平台,专注于模型性能对比与多场景任务评测,在写作创作、代码开发支持和知识问答等方面表现出色。然而,平台在模型泛化能力、高并发性能和内容质量控制上仍有改进空间。总体而言,ModelScope为开发者提供了高效便捷的工具,未来有望进一步推动AI技术普惠化。
617 10
|
负载均衡 应用服务中间件 Linux
在Linux中,Nginx如何实现负载均衡分发策略?
在Linux中,Nginx如何实现负载均衡分发策略?
|
人工智能 安全 区块链
区块链与人工智能的融合道路:揭秘未来科技新风口
在科技创新的浪潮中,区块链与人工智能正交汇融合,如双星辉映,激发无限潜能。区块链以去中心化、不可篡改的特性革新数据安全与信任;AI则以强大算法引领工业革命。两者融合,为AI提供安全数据基础,使数据可追溯、不可篡改,同时利用AI提升区块链效率与自动化水平,加速交易验证,最终在金融、医疗等领域催生创新应用,深刻影响社会进步与民众生活,成为未来技术发展的核心动力。
898 1
|
机器学习/深度学习 数据可视化 搜索推荐
使用Python实现深度学习模型:智能睡眠监测与分析
使用Python实现深度学习模型:智能睡眠监测与分析
1370 2
|
弹性计算 自然语言处理 API
速成RAG+Agent框架大模型应用搭建
本文侧重于能力总结和实操搭建部分,从大模型应用的多个原子能力实现出发,到最终串联搭建一个RAG+Agent架构的大模型应用。
|
存储 开发框架 安全
鸿蒙 HarmonyOS NEXT星河版APP应用开发-阶段一
HarmonyOS NEXT星河版的应用开发标志着华为分布式操作系统的全新篇章,它聚焦于打造原生精致、易用、流畅、安全、智能和互联的极致体验。开发者可以利用其先进的API和工具集,如DevEco Studio,构建高性能、跨设备无缝协同的应用程序,从而充分利用HarmonyOS的分布式能力,为用户带来一致且丰富的多场景数字生活体验。随着“学习强国”、岚图汽车、中国电信等知名企业和应用的加入,鸿蒙生态正迅速扩展,引领着原生应用开发的新趋势。
620 3
鸿蒙 HarmonyOS NEXT星河版APP应用开发-阶段一
|
12月前
|
人工智能 自然语言处理 机器人
对话阿里云CIO蒋林泉:AI时代,企业如何做好智能化系统建设?
10月18日, InfoQ《C 位面对面》栏目邀请到阿里云CIO及aliyun.com负责人蒋林泉(花名:雁杨),就AI时代企业CIO的角色转变、企业智能化转型路径、AI落地实践与人才培养等主题展开了讨论。
|
图形学
Qt&Vtk-003-读取jpg、png、dicom等格式图片
本文其实才能算是真正的Qt与Vtk结合,具体实现JPG、PNG、TIFF、DICOM、BMP及一个3D Cube显示。
813 1
Qt&Vtk-003-读取jpg、png、dicom等格式图片
|
Java 数据库连接 编译器
Java注解详解,自定义注解,利用反射解析注解
概要 这篇文章将会带领你了解Java注解,注解的使用,注解的解析,利用反射解析运行时注解,相信有一定Java基础的小伙伴一定会接触大量的注解,Spring , Hibernate , MyBatis等著名的框架也有很多关于注解方面的应用,对于注解的使用...
2835 0