ลง phpmyadmin ubuntu ใน Digitalocean
ทำการ update ก่อน
sudo apt-get update
ทำการติดตั้ง phpmyadmin
sudo apt-get install phpmyadmin
- For the server selection, choose apache2.
- Select yes when asked whether to use
dbconfig-common
to set up the database - You will be prompted for your database administrator’s password
- You will then be asked to choose and confirm a password for the
phpMyAdmin
application itself
ให้ทำการ restart apache
sudo service apache2 restart
http://domain_name_or_IP/phpmyadmin
การสร้าง .htaccess เผื่อป้องกันการเข้าถึงอีกชั้นหนึ่ง โดยให้เพิ่มตรงสีแดงเข้าไป
Configure Apache to Allow .htaccess Overrides
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
. . .
To implement the changes you made, restart Apache:
ให้ทำการ restart apache
sudo service apache2 restart
Create an .htaccess File
Now that we have enabled .htaccess
use for our application, we need to create one to actually implement some security.
In order for this to be successful, the file must be created within the application directory. We can create the necessary file and open it in our text editor with root privileges by typing:
sudo nano /usr/share/phpmyadmin/.htaccess
Within this file, we need to enter the following information:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
Create the .htpasswd file for Authentication
Now that we have specified a location for our password file through the use of the AuthUserFile
directive within our .htaccess
file, we need to create this file.
We actually need an additional package to complete this process. We can install it from our default repositories:
sudo apt-get install apache2-utils
ที่มา : DigitalOcean