4

I want to deploy my project in virtual host in CentOS running server. I have this

<Directory />
#change value of next line from none to all
    AllowOverride none
    Require all denied
</Directory>
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName project.com
ServerAlias www.project.com
DocumentRoot /var/www/html/project

<Directory /var/www/html/project>
        DirectoryIndex index.php
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
</Directory>
</VirtualHost>

In the httpd.conf in the /etc/httpd/conf folder I also have this

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
#127.0.0.1    localhost.localdomain localhost host.server4-245.com
#::1          localhost.localdomain localhost host.server4-245.com
192.168.1.97   www.project.com
127.0.0.1      www.project.com

In the hosts in the /etc folder but when i try to access http://project.com/ in the browser I get :

This site can’t be reached

project.com’s server DNS address could not be found. Search Google for project ERR_NAME_NOT_RESOLVED

after altering this I restarted the httpd using

systemctl restart httpd

When I do this in ubuntu I happened to do one step that I cant do in centOS. The step below:

sudo a2ensite httpd.conf

When I search for the equivalent of this command in centOS there is none.

What could be missing in my config? Could it be that I was not able to reload the httpd.conf?

***UPDATE***

when I try to access using IP like 192.168.1.97/project When I have the virtual host config I cant access when I comment out the config I can access it.

***Update***

When I rune netstat -autnp | grep "\:80" | grep LISTEN

I get :

tcp6 0 0 :::80 :::* LISTEN 6905/httpd

guradio
  • 141
  • 5

1 Answers1

0

You are accessing hxxp://project.com/ but you only have www.project.com in your /etc/hosts file. you need to add an entry for project.con too

192.168.1.97   www.project.com project.com
127.0.0.1      www.project.com project.com
user9517
  • 115,471
  • 20
  • 215
  • 297