0

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 Jun 7 '16 at 11:53
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
</VirtualHost>

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

<VirtualHost somewebsite.com:80>
    ServerAdmin webmaster@example.com
    DocumentRoot /path/to/htdocs/yourwebsiteFolder
    ServerName www.yourwebsite.com
    ServerAlias yourwebsite.com
</VirtualHost>

then restart httpd daemon using sudo systemctl restart httpd.service

VirtualHost Examples will help you more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.