Last active
September 1, 2020 16:16
-
-
Save guillorrr/f55769e57e81573b1b723b6c46bf5e98 to your computer and use it in GitHub Desktop.
Change phpMyAdmin port from 80 to another number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Listen 8081 | |
| <VirtualHost *:8081> | |
| ServerName localhost | |
| <Directory /usr/share/phpmyadmin> | |
| AllowOverride None | |
| Require all granted | |
| </Directory> | |
| DocumentRoot /usr/share/phpmyadmin | |
| Include /etc/phpmyadmin/apache.conf | |
| ErrorLog ${APACHE_LOG_DIR}/phpmyadmin.error.log | |
| CustomLog ${APACHE_LOG_DIR}/phpmyadmin.access.log combined | |
| </VirtualHost> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # By default PhpMyAdmin is included into the Apache's configuration through this additional configuration file: | |
| # /etc/apache2/conf-enabled/phpmyadmin.conf | |
| # This file is a symbolic link to the file: | |
| # /etc/apache2/conf-available/phpmyadmin.conf | |
| # Which is a symbolic link to the file: | |
| # /etc/phpmyadmin/apache.conf | |
| # Create new VirtualHost configuration file: | |
| sudo nano /etc/apache2/sites-available/phpmyadmin.conf | |
| # disable the default phpMyAdmin's configuration | |
| sudo a2disconf phpmyadmin | |
| # enable the new VirtualHost | |
| sudo a2ensite phpmyadmin | |
| # restart apache | |
| sudo systemctl restart apache2.service | |
| # This step is optional, but otherwise http://localhost:8081 and http://localhost:8081/phpmyadmin will provide identical result | |
| sed -e '/Alias \/phpmyadmin \/usr\/share\/phpmyadmin/ s/^#*/#/' -i /etc/phpmyadmin/apache.conf | |
| # Add port 99 into firewall's rules. | |
| # If you use UFW you can do that by this command: | |
| sudo ufw allow 8081/tcp | |
| # With iptables you can do that by this command: | |
| sudo iptables -A INPUT -p tcp -m tcp --dport 8081 -j ACCEPT | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment