I'm setting up a server with centos 7 and I have already installed Apache and php. I have tried to set-up a virtual-host to avoid "localhost/xxx.xxx", but now I cannot access to local-host any more. But, if I write the website that I set for the virtual-host and then I go back to the previous page Apache work and it open the php page that I was trying to open. I have tried to delete the virtual host that I have set but I don't remember how to do this.

  • did this solved your problem ?
    – Rahul
    Commented Jun 7, 2016 at 11:53

1 Answer 1


This is normal if you see it. Since it is the first virtual host entry it will show local host.

but still you can set that up in httpd.conf,

<VirtualHost localhost:80>
    ServerAdmin localhost
    DocumentRoot /path/to/htdocs/
    ServerName localhost

To run projects like http://yourwebsite.com locally

<VirtualHost somewebsite.com:80>
    ServerAdmin [email protected]
    DocumentRoot /path/to/htdocs/yourwebsiteFolder
    ServerName www.yourwebsite.com
    ServerAlias yourwebsite.com

then restart httpd daemon using sudo systemctl restart httpd.service

VirtualHost Examples will help you more.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .