phpMyAdmin is a không lấy phí and mở cửa source administration tool for MySQL và MariaDB. As a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, especially for web hosting services. In this guide, we are going to lớn install phpMyAdmin with Apache on CentOS 7.
Bạn đang xem: Hướng dẫn cài đặt phpmyadmin trên centos 7Bạn đang xem: How khổng lồ install and secure phpmyadmin with apache on a centos 7 server
An important prerequisite before using this guide is khổng lồ install a LAMP (Linux, Apache, MariaDB, và PHP) stack on your CentOS 7 server. The LAMP stack is the platform which will be used khổng lồ serve our phpMyAdmin interface (MariaDB is also the database management software that we are wishing lớn manage). If you vì chưng not yet have a LAMP installation on your server, click here lớn read our tutorial on installing LAMP on CentOS 7.
Step 1: địa chỉ cửa hàng EPEL repo: We need to địa chỉ cửa hàng the EPEL repo (Extra Packages for Enterprise Linux) to lớn our server before proceeding with installation has it contains many additional packages, including the phpMyAdmin package we are looking for. To install, type the command below:
sudo yum install epel-releaseStep 2: Install phpMyAdmin: Type the command below to install the phpMyAdmin package using the yum packaging system followed by y to lớn continue:
sudo yum install phpmyadmin
The installation includes an Apache configuration file that has been placed in its appropriate directory. We need to lớn modify this config tệp tin for our installation to lớn work perfectly for our needs.
Open the phpMyAdmin.conf in the /etc/httpd file in the text editor(nano in this guide) lớn make a few modifications:
sudo nano /etc/httpd/conf.d/phpMyAdmin.confCurrently, the thiết lập in the configuration tệp tin is configured to lớn deny access khổng lồ any connection not being made from the vps itself. Since we are assessing our vps remotely (via ssh), we need lớn modify some lines khổng lồ specify the IP address of your trang chủ connection.
The first location is the section as shown below:
Change any lines that read Require ip 127.0.0.1 or Allow from 127.0.0.1 to lớn refer khổng lồ your trang chủ connection"s IP address.
Note: If you need help finding your home connection"s IP, click here to lớn check.
The second location is the section as shown below:
Note: Your trang chủ connections" IP address differs from the IP address of your VPS.
After making the configurations, restart the Apache web hệ thống by typing:
sudo systemctl restart httpd.serviceTo access the interface, visit your public IP address or server"s domain name followed by /phpMyAdmin, in your web browser:
Log into the phpmyadmin interface using the root username & the administrative password you mix up during the MySQL installation. After logging in, the user interface looks like the screenshot below:
SECURING YOUR PHPMYADMIN INSTANCE
Securing your phpmyadmin is important in order to prevent unauthorized access. An easy way to vày this is khổng lồ change the location of the interface from /phpMyAdmin lớn something else to prevent automated bot brute-force attempts.
Open the configuration tệp tin using the command below:
sudo nano /etc/httpd/conf.d/phpMyAdmin.confThe two lines below are the default aliases that serve us nội dung from the /usr/share/phpMyAdmin location if we access our site"s domain name name or IP address, followed by either /phpMyAdmin or /phpmyadmin.
Alias /phpMyAdmin /usr/share/phpMyAdminAlias /phpmyadmin /usr/share/phpMyAdmin
We are going to lớn disable these mặc định aliases due lớn the high rate at which they are targeted by bots & malicious users. For security purposes, we should decide on our own alias having these two rules in mind:It shouldn"t indicate the purpose of the URL location.It should be easy to remember but not easy to guess.
In this guide, we are going to use /somethingelse.
To apply our changes, we are going to phản hồi out the existing lines (you can remove them enirely) and địa chỉ our own:
#Alias /phpMyAdmin /usr/share/phpMyAdmin#Alias /phpmyadmin /usr/share/phpMyAdminAlias /somethingelse /usr/share/phpMyAdmin
Save & close the file then proceed to lớn restart httpd with the command below:
sudo systemctl restart httpd.serviceIf you visit the previous location of your phpMyAdmin installation, you will get a 404 error:
You can also secure phpMyAdmin placing a gateway in front of the entire application by using Apache"s built-in .htaccess authentication and authorization functionalities.
Firstly, we will need lớn enable the use of .htaccess tệp tin overrides by editing our Apache configuration file. Xuất hiện the phpmyadmin.conf with the command below:
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Save the file before closing then proceed to restart Apache with the command:
sudo systemctl restart apache2After enabling .htaccess use, we need khổng lồ create the tệp tin to fully implement security by typing the command below:
sudo nano /usr/share/phpmyadmin/.htaccessAuthType BasicAuthName "Restricted Files"AuthUserFile /etc/phpmyadmin/.htpasswdRequire valid-user
Type the command below to showroom the password to the htaccess file:
sudo htpasswd -c /etc/httpd/pma_pass username
To địa chỉ additional users to lớn authenticate, type the same command again but this time without the -c flag, và with a new username:
sudo htpasswd /etc/httpd/pma_pass seconduserWith this, whenever you access phpMyAdmin on your domain, you will be prompted for the additional account name và password that you just configured as shown below: With this, whenever you access phpMyAdmin on your domain, you will be prompted for the additional trương mục name & password that you just configured as shown below:
After typing the Apache authentication password, you"ll be redirected to lớn the original phpMyAdmin authentication page lớn enter your other credentials.
Có gì mới
soi ước mn thabet soi mong kubet tỷ lệ kèo đá bóng xác suất kèoTải phầm mềm mmlive đến androidtải qqlive game android android