Wednesday, April 13, 2016

Set Own URL for localhost apache

2 areas to look at...


  1. /etc/hosts
  2. /etc/httpd/conf/httpd.conf
  • For /etc/hosts
    • Add the IP address and the URL (ServerName) in this file
 Example: 127.0.0.1  www.mywebsite.com
  • For /etc/httpd/conf/httpd.conf
    • Add the following
 <VirtualHost *:80>
  ServerName www.mywebsite.com
  DocumentRoot "/var/www/'where the folder is'"
  DirectoryIndex index.html OR 'which ever file'
 </VirtualHost>


After everything done...
  1. Restart httpd.service
    • Terminal# systemctl restart httpd.service
  2. Restart web brower

Reference

No comments:

Post a Comment