alex
alex

Reputation: 61

how to access phpmyadmin only the port 8080 in apache

I've tried

vim /etc/phpmyadmin/apache.conf

but I can not put a VirtualHost here.

I want to change this configuration to list only the port 8080, can anyone help?

thank you

what I want is:

www.site.com/phpmyadmin -> failure
www.site.com:8080/phpmyadmin -> OK

I want to leave access to port 80 for the rest of the site.

Upvotes: 3

Views: 71809

Answers (2)

regilero
regilero

Reputation: 30496

Usually the phpmayadmin configuration is included for all the Virtualhosts, that's a package installation behavior, and that's quite bad.

The file /etc/phpmyadmin/apache.conf is included from the main configuration (sometimes from a file in /etc/apache2/conf.d/phpmyadmin.conf).

Thoe first thing you could do is remove this main-all-virtualhosts-inclusion and only include this file with the Include keyword in one Virtualhost.

This allows two things, first you could use a dedicated ServerName for this host. Second you can alter the Port of the Virtualhost (or you can just do one of theses things). Check this previous answer about IP/Name Virtualhosts, it will help you figure how Virtualhosts works. The Solution for you is to:

  • forbid the phpmyadmin configuration inclusion on the main-general-shared configuration level
  • Listen on both port 80 and 8080
  • Declare two NameVirtualHost, one on *:80 one on *:8080
  • Use a Virtualhost *:80 for classical application/websites, ServerName: www.site.com, ensure phpmyadmin configuration file is not included
  • Use a Virtualhost *:8080 including the phpmyadmin configuration, ServerName: www.site.com

Upvotes: 0

Jmc
Jmc

Reputation: 830

You can change the Listen directive to 8080.

Search the apache configuration for Listen and change it from

Listen 80

to

Listen 8080

And restart the server. Bear in mind, this will be global to the whole apache server though. On centos or redhat, it'll be called "httpd.conf"

Upvotes: 2

Related Questions