Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localhost/phpmyadmin can't access when setting virtualhost

Here is the situation :

I have a project which I want to run on localhost as http://www.coye.com/ for which I have setup a virtual host which is running perfectly like this:

F:\xampp\apache\conf\extra\httpd-vhosts.conf :

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/coye"
ServerName coye.com
ServerAlias www.coye.com
RewriteEngine on

#Added New by Sandeep - Start
RewriteCond %{HTTP_HOST} !^www.coye\.com$ [NC]
RewriteRule ^(.*)$ http://www.coye.com$1 [R=301,L]

RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/css
RewriteCond %{REQUEST_URI} !^/js
RewriteCond %{REQUEST_URI} !^/fckeditor
RewriteCond %{REQUEST_URI} !^/securityimage
RewriteCond %{REQUEST_URI} !^/sitemap.txt
RewriteRule ^/(.*)$ /index.php?request=$1 [PT,QSA,L]
</VirtualHost>

C:\Windows\System32\drivers\etc\host

127.0.0.1 localhost
127.0.0.1 coye.com 
127.0.0.1 www.coye.com 
127.0.0.1 api.coye.com 
127.0.0.1 merchant.coye.com 
127.0.0.1 admin.coye.com

and now I want to run PHPMyadmim but it not accessible through localhost/phpmyadmin. What changes I have to do to get access PHPMyadmin ? Please guide me on this.

Please help me on this.

like image 542
Rakesh Shetty Avatar asked Aug 04 '14 06:08

Rakesh Shetty


People also ask

Why my localhost phpMyAdmin is not opening?

Try starting MySQL and Apache in Xampp. Verify Port Number assigned to Apache (By default it should be 80). Now load localhost/phpmyadmin . It solved my problem.

How do I access phpMyAdmin localhost?

Once phpMyAdmin is installed point your browser to http://localhost/phpmyadmin to start using it. You should be able to login using any users you've setup in MySQL. If no users have been setup, use admin with no password to login.

Why phpMyAdmin is not working in XAMPP?

I solved this problem by changing the proxy of my firefox browser, go to menu tools-Option find tab Network, click button settings. Fill the text box below No Proxy for with localhost. Then press Ok, then Ok again. Try now typing localhost/xampp then it should show Welcome to XAMPP for Windows!


2 Answers

Finally I found the solution for my problems, hope this will help to others you will face the similar problem :

I have to add this extra piece of code:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs"
ServerName localhost
</VirtualHost>

So the final file will be -

httpd-vhosts.conf :

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs"
ServerName localhost
</VirtualHost>


<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/coye"
ServerName coye.com
ServerAlias www.coye.com
RewriteEngine on

#Added New by Sandeep - Start
RewriteCond %{HTTP_HOST} !^www.coye\.com$ [NC]
RewriteRule ^(.*)$ http://www.coye.com$1 [R=301,L]

RewriteCond %{REQUEST_URI} !^/images
RewriteCond %{REQUEST_URI} !^/css
RewriteCond %{REQUEST_URI} !^/js
RewriteCond %{REQUEST_URI} !^/fckeditor
RewriteCond %{REQUEST_URI} !^/securityimage
RewriteCond %{REQUEST_URI} !^/sitemap.txt
RewriteRule ^/(.*)$ /index.php?request=$1 [PT,QSA,L]
</VirtualHost>

host file :

127.0.0.1 localhost
127.0.0.1 coye.com 
127.0.0.1 www.coye.com 
127.0.0.1 api.coye.com 
127.0.0.1 merchant.coye.com 
127.0.0.1 admin.coye.com

Thanks to everyone who try to help me.

like image 158
Rakesh Shetty Avatar answered Nov 15 '22 09:11

Rakesh Shetty


See you have to keep the original config in hosts file

127.0.0.1 localhost

and to access phpmyadmin you need to go to phpmyadmin.local and not to localhost/phpmyadmin

Virtualhost Config

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/usr/local/zend/apache2/htdocs/l2/public"
    ServerName coye.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot ""
    ServerName **phpmyadmin.dev**
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

let me know if it works.

like image 21
Ayush Ghosh Avatar answered Nov 15 '22 09:11

Ayush Ghosh