# Secure phpmyadmin

**URL:** <https://forum.hestiacp.com/t/secure-phpmyadmin/5563>\
**Category:** Uncategorized\
**Created:** [February 10, 2022, 12:28am UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563 "2022-02-10T00:28:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![delfo2000](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@delfo2000](https://forum.hestiacp.com/u/delfo2000)\
**Post date:** [February 10, 2022, 12:28am UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/1 "2022-02-10T00:28:10Z")

</div>

Dear,

I’m new here and it’s my first time I use hestia very nice cp, non I want secure “phpmyadmin”, my target is block load phpmyadmin from [https://www.example.com/phpmyadmin](https://www.example.com/phpmyadmin).  
Is there easy way?  
Best reagrds

G.

---

<div class="post-metadata">

**Author:** ![pluto](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/p/f08c70/32.png) [@pluto](https://forum.hestiacp.com/u/pluto)\
**Post date:** [February 10, 2022, 3:32am UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/2 "2022-02-10T03:32:45Z")

</div>

You can edit /etc/apache2/conf.d/phpmyadmin.inc and add Apache Basic Auth to it.  
For example, find this line:

```auto
<Directory /usr/share/phpmyadmin>
	Options FollowSymLinks

```

And insert lines like this, changing the location of AuthUserFile accordingly

```auto
<Directory /usr/share/phpmyadmin>
        AuthType Basic
        AuthName Private
        Require valid-user
        AuthUserFile /etc/apache2/phpmyadmin.passwd
        Options FollowSymLinks

```

One problem is that the file sometimes gets overwritten, so you have to monitor that and reinsert if it disappears.

Oh, yes, and generate the password file with htpasswd:  
`htpasswd -c /etc/apache2/phpmyadmin.passwd username`  
You can add several user/password combinations to the same file

---

<div class="post-metadata">

**Author:** ![Raphael](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/raphael/32/5217_2.png) [@Raphael](https://forum.hestiacp.com/u/Raphael)\
**Post date:** [February 10, 2022, 7:01am UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/3 "2022-02-10T07:01:01Z")

</div>

> [@pluto](#):
>
> /etc/apache2/conf.d/phpmyadmin.inc

Or just remove that file to prevent phpmyadmin loading 🙂.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [February 10, 2022, 7:15am UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/4 "2022-02-10T07:15:18Z")

</div>

Or remove it from any template that you don’t want…

For [Hestiacp.com](http://Hestiacp.com) I have created “nophpmyadmin” that doesn’t load the template…

```auto
#=======================================================================#
# Default Web Domain Template #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
#=======================================================================#

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %docroot%
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
        
    IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
    
    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>
    <Directory %sdocroot%>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:%backend_lsnr%|fcgi://localhost"
    </FilesMatch>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
</VirtualHost>

```

---

<div class="post-metadata">

**Author:** ![delfo2000](https://forum.hestiacp.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@delfo2000](https://forum.hestiacp.com/u/delfo2000)\
**Post date:** [February 10, 2022, 8:54pm UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/5 "2022-02-10T20:54:08Z")

</div>

Hi All,

thank you for reply and help. I’m using “ScIT” solution and rename `/etc/apache2/conf.d/phpmyadmin.inc`  
for me is easy solution, but I understand other solutions maybe better ex. I want load phpmyadmin only from my network.  
Thank you again.  
Best regards

G.

---

<div class="post-metadata">

**Author:** ![system](https://forum.hestiacp.com/uploads/default/original/1X/d9a5b68bf50ced83e880b56452e592b204761b19.png) [@system](https://forum.hestiacp.com/u/system)\
**Post date:** [March 12, 2022, 8:54pm UTC](https://forum.hestiacp.com/t/secure-phpmyadmin/5563/6 "2022-03-12T20:54:51Z")

</div>

Closed on March 12, 2022, 8:54pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
