Sankalp
Sankalp

Reputation: 1350

Configuring two server simultaneously at apache local

I wanna configure two server simutaneoulsy at my apache. one is with name localhost n another is with name shadaab.

What I did was edited C:\xampp\apache\conf\httpd.conf and added these lines at last of files

    NameVirtualHost localhost

    <VirtualHost localhost>
        DocumentRoot "C:/xampp/htdocs"
        ServerName localhost 
    </VirtualHost> 


    NameVirtualHost shadaab

    <VirtualHost shadaab> 
        DocumentRoot "F:/projects/all/" 
        ServerName shadaab
    </VirtualHost> 

Restarted apache server. When I browse in url localhost its working fine but when I did for 'shadaab' it doesn't work.

Later on how mysql will be connected with shadaab server pelase help. What other changes do I need to do.

Upvotes: 0

Views: 124

Answers (2)

Nicolas Racine
Nicolas Racine

Reputation: 1061

add

127.0.0.1 shadaab

in your host file

You will be able to connect to your mysql server via shadaab. shadaab will point to 127.0.0.1

Upvotes: 1

Sammitch
Sammitch

Reputation: 32272

Your config is WAY off. I suggest reading some documentation.

Your config should look something like:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost 
</VirtualHost> 

<VirtualHost 127.0.0.1:80> 
    DocumentRoot "F:/projects/all/" 
    ServerName shadaab
</VirtualHost>

Or replace 127.0.0.1 with * to make apache listen on all IP addresses, not just the loopback.

Upvotes: 1

Related Questions