【问题标题】:Access phppgadmin from another computer?从另一台计算机访问 phppgadmin?
【发布时间】:2010-07-26 05:40:01
【问题描述】:

我已经在 Ubuntu 服务器上安装了 phppgadmin,并想从另一台计算机访问它。

当我输入时它说访问被拒绝:

 http://<ip>/phppgadmin

5432 端口在 Ubuntu 服务器中打开,但仅用于本地 ip。

谢谢

【问题讨论】:

    标签: phppgadmin


    【解决方案1】:

    默认情况下,/etc/apache2/conf.d/phppgadmin.conf 配置文件会阻止除 localhost 之外的任何人访问 PhpPgAdmin。

    添加一行,为您的 IP 创建一个新的允许规则,所以它看起来像这样:

    <Location /phppgadmin>
      Order deny,allow
      Deny from all
      Allow from [Your client IP]
    </Location>
    

    顺便说一句,这种问题可能更适合stackoverflow的姐妹网站serverfault.com

    【讨论】:

    • 感谢您的回答。它为我节省了很多时间 :) 你值得再次投票......
    • 您必须重新启动 apache 服务器,直到您无法访问您所做的更改 sudo service apache2 start
    【解决方案2】:

    这是一个 apache(或 Web 服务器)问题。您的 phppgadmin 目录有一个 .htaccess 文件,不允许除 localhost 之外的所有人。

    您需要将其设置为允许全部或允许(在此处插入 IP)

    【讨论】:

      【解决方案3】:

      我知道这是一个老问题,但因为我偶然发现它试图修复“加载资源失败:服务器响应状态为 403(禁止)”错误,同时尝试从另一台计算机访问 phpPgAdmin 和给定答案对我不起作用,我想分享我的解决方案。

      Ubuntu:17.04; phpPgAdmin:5.1

      解决方案: 在 /etc/apache2/conf-enabled/phppgadmin.conf 中注释掉 Require local 并重启 apache(sudo service apache2 reload)

      <Directory /usr/share/phppgadmin>
      
      <IfModule mod_dir.c>
      DirectoryIndex index.php
      </IfModule>
      AllowOverride None
      
      # Only allow connections from localhost:
      # Require local
      
      <IfModule mod_php.c>
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        #php_value include_path .
      </IfModule>
      <IfModule !mod_php.c>
        <IfModule mod_actions.c>
          <IfModule mod_cgi.c>
            AddType application/x-httpd-php .php
            Action application/x-httpd-php /cgi-bin/php
          </IfModule>
          <IfModule mod_cgid.c>
            AddType application/x-httpd-php .php
            Action application/x-httpd-php /cgi-bin/php
          </IfModule>
        </IfModule>
      </IfModule>
      
      </Directory>
      

      /etc/apache2/conf-enabled/phppgadmin.conf

      【讨论】:

        【解决方案4】:

        你在运行 Apache 吗?

        您需要在 httpd.conf 文件或 .htaccess 中更改您的权限

        http://httpd.apache.org/docs/2.0/misc/security_tips.html

        【讨论】:

          【解决方案5】:

          我也想分享我的解决方案。

          在 64 位 ARM 上带有 Apache 2.4.38 和 phpPgAdmin 5.1 的 Debian 10.1。

          以下配置将允许本地和 LAN 访问,但(出于安全原因)不允许 WAN 访问。

          /etc/apache2/conf-enabled/phppgadmin.conf

          <Directory /usr/share/phppgadmin>
          
          <IfModule mod_dir.c>
          DirectoryIndex index.php
          </IfModule>
          AllowOverride None
          
          # Only allow connections from localhost:
          #Require local
          Order deny,allow
          Deny from all
          Allow from ::1
          Allow from 127.0.0.1
          Allow from 192.168.0.0/16
          Allow from 172.16.0.0/12
          Allow from 10.0.0.0/8
          
          <IfModule mod_php.c>
            php_flag magic_quotes_gpc Off
            php_flag track_vars On
            #php_value include_path .
          </IfModule>
          <IfModule !mod_php.c>
            <IfModule mod_actions.c>
              <IfModule mod_cgi.c>
                AddType application/x-httpd-php .php
                Action application/x-httpd-php /cgi-bin/php
              </IfModule>
              <IfModule mod_cgid.c>
                AddType application/x-httpd-php .php
                Action application/x-httpd-php /cgi-bin/php
              </IfModule>
            </IfModule>
          </IfModule>
          
          </Directory>
          

          【讨论】:

            猜你喜欢
            • 2015-02-10
            • 2019-01-03
            • 2018-10-13
            • 2021-08-15
            • 2015-08-06
            • 1970-01-01
            • 2019-07-04
            • 2017-03-08
            相关资源
            最近更新 更多