You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

同一主机连接VPN时Apache拒绝phpMyAdmin连接的问题排查

Hey Louis, let's dig into this phpMyAdmin access issue you're facing—it's a common gotcha with VPN setups, so let's break it down step by step:

Troubleshooting phpMyAdmin Access Blocked After PPTP VPN Connection

1. Apache is seeing your VPN client's internal IP, not the public server IP

When you connect via PPTP VPN, even though your public outbound IP shows as 160.x.x.x, the connection from your Windows machine to the server's Apache actually uses the private internal IP assigned by the PPTP server (like 192.168.0.x or 10.x.x.x). Check your Apache logs—you'll probably see this private IP listed as the source of the blocked request.

To fix this:

  • Edit your phpmyadmin.conf and add the PPTP client's private IP or the entire PPTP subnet to the allowed list. For example, if your PPTP pool is 192.168.10.0/24:
    # If using Apache 2.2 or older
    Allow from 160.x.x.x
    Allow from 192.168.10.0/24
    
    # If using Apache 2.4+ (recommended syntax)
    Require ip 160.x.x.x
    Require ip 192.168.10.0/24
    
  • Restart Apache to apply changes:
    # Debian/Ubuntu
    sudo systemctl restart apache2
    
    # RHEL/CentOS
    sudo service httpd restart
    

2. Don't mix old and new Apache access control syntax

If your server runs Apache 2.4+, the Require directive takes priority over the older Allow from/Deny from rules. Mixing them can cause unexpected blocking. Stick to one syntax—preferably the modern Require ip approach for consistency.

3. Verify your VPN routing is fully working

Even though Google shows your public IP as 160.x.x.x, double-check that all traffic to your server is actually going through the VPN:

  • On your Windows machine, open the VPN connection details and confirm the IPv4 default gateway is set to the PPTP server's internal IP.
  • Run tracert 160.x.x.x in Command Prompt—if the first hop is your local router instead of the VPN gateway, your "use remote gateway" setting isn't routing server-bound traffic correctly. You may need to adjust the PPTP server's pptpd.conf to push the default route to clients.

4. Ensure you're editing the correct phpmyadmin.conf file

It's easy to modify a config file that Apache isn't actually loading. Verify the file's location and inclusion:

  • On Debian/Ubuntu, the active config is usually /etc/apache2/conf-available/phpmyadmin.conf—make sure it's enabled with sudo a2enconf phpmyadmin.
  • Check loaded configs with:
    # Debian/Ubuntu
    apache2ctl -S
    
    # RHEL/CentOS
    httpd -S
    
    Look for phpmyadmin.conf in the list of included files.

内容的提问来源于stack exchange,提问作者Louis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:43:46