Hello,
I am facing a very strange issue while setting a virtual host on apache to setup multiple websites using separate IPs.
Virtual host is setup but when i am browsing the website it display content under /var/www/html and displaying site1 and site2 folder instead of access the content under respective directory as mentioned in virtual host file.
Below is the steps and virtual host configuration i setup
sudo chown -R apache:apache /var/www/html/site1
sudo chown -R apache.apache /var/www/html/site2
chmod -R 755 /var/www
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled
Added IncludeOptional sites-enabled/*.conf line in /etc/httpd/conf/httpd.conf file
vim /etc/httpd/sites-available/site1.conf
vim /etc/httpd/sites-available/site2.conf
ln -s /etc/httpd/sites-available/site1.conf /etc/httpd/sites-enabled/site1.conf
ln -s /etc/httpd/sites-available/site1.conf /etc/httpd/sites-enabled/site2.conf
systemctl restart httpd
Below is configuration added to created apache host
site1.conf
<VirtualHost 192.168.1.11:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/site1
ServerName example.com
ServerAlias Example Domain
<Directory /var/www/html/site1/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
site2.conf
<VirtualHost 192.168.1.12:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/site2
ServerName example.com
ServerAlias Example Domain
<Directory /var/www/html/site2/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I am using CentOS7 and I already disabled selinux and firewalld
Please help me out here.