0

I have a php web application running on the VM. I’m trying to change the domain name from local host to customised name. I did the following changes but still it didn’t work. Please correct/help me what I’m doing wrong/missing here.

  1. Added website name in etc/hosts file as 127.0.0.1 website-name
  2. Enabled httpd-vhosts file in httpd file in apache/conf
  3. Added virtual host tag with required details in httpd-vhosts.conf file
  4. Restarted apache server After this, if I try to connect to this application with the mentioned domain name in the browser, it shows page cannot display.

I tried the similar process available on internet, not sure where it goes wrong. This on virtual machine running with windows.

Robin clave
  • 608
  • 6
  • 16
  • 32
  • 1
    So you edited the `/etc/hosts` in the VM but try to access the website from the host machine ? Or did you edited your Windows host file ? What's the result in the browser when you try to reach your app ? – AymDev Nov 03 '21 at 08:25
  • Thanks for your response. I edited the file in the vm and accessing from the same vm. The result in the browser is “ this site cannot be reached”. – Robin clave Nov 03 '21 at 08:28
  • Any thoughts on this please – Robin clave Nov 03 '21 at 10:27
  • Inside the VM the website works fine? Since you edit hosts file. Have you already pointed your domain to the IP, and what's the error you're facing? Details of the error would be helpful. – sykez Nov 03 '21 at 10:45

1 Answers1

0

Enable errors and access log in order to see why you cannot access your website. And instead of IP address you can put asterisk(which means any address), just for test. Example of Vhost is below.

<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com
    ErrorLog "path/to/error.log"
    CustomLog "path/to/access.log" common
</VirtualHost>

Apache Vhost example, Apache ErrorLog Directive, Apache CustomLog Directive

Check website folder rights and permissions. Webserver wont be able to process your files unless everthing is under root user. Here is an example of how you can do this.

Hope that will help to debug the issue a bit )

Sergey Ligus
  • 462
  • 3
  • 10