URL shows directory listing instead of website

1.4k views Asked by At

I have VPS with more than one domain hosted in centos. Given below was my httpd.conf

        NameVirtualHost *:80
        NameVirtualHost *:443

        <Directory "/var/www/html">
         Options +FollowSymLinks
         AllowOverride All
         Order allow,deny
         Allow from all
        </Directory>


        <VirtualHost *:80>
            ServerAdmin [email protected]
            DocumentRoot /var/www/html/abc.in
            ServerName abc.in
            ServerAlias abc.in
            ErrorLog logs/abc-error_log
            CustomLog logs/abc-access_log common
        </VirtualHost>

        <VirtualHost *:443>
            ServerAdmin [email protected]
            DirectoryIndex index.php
            DocumentRoot "/var/www/html/abc.in"
            ServerName www.abc.in
            ServerAlias abc.in
         ErrorLog logs/abc.in-error_log
            CustomLog logs/abc.in-access_log common
            ServerAlias abc.in
          <Directory "/var/www/html/abc.in">
            Options Indexes FollowSymLinks
            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
        </VirtualHost>

        <VirtualHost *:80>
            ServerAdmin [email protected]
            DocumentRoot /var/www/html/blog
            ServerName blog.abc.in
            ErrorLog logs/blog-error_log
            CustomLog logs/blog-access_log common

        <Directory "/var/www/html/blog">
            Options Indexes FollowSymLinks MultiViews Includes
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>

        </VirtualHost>
        <VirtualHost *:80>
            ServerAdmin [email protected]
            DocumentRoot /var/www/html/domain1
            ServerName domain1.abc.in
            ErrorLog logs/ped-error_log
            CustomLog logs/ped-access_log common

        <Directory "/var/www/html/domain1">
            Options Indexes FollowSymLinks MultiViews Includes
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>

        </VirtualHost>

         <VirtualHost *:80>
            ServerAdmin [email protected]
            DocumentRoot /var/www/html/domain2
            ServerName domain2.com
            ServerAlias www.domain2.com
            ErrorLog logs/domain2-error_log
            CustomLog logs/domain2-access_log common
        <Directory "/var/www/html/domain2">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>

        </VirtualHost>


        <VirtualHost *:80>
            ServerAdmin [email protected]
            DocumentRoot /var/www/html/domain3
            ServerName domain3.co
            ServerAlias www.domain3.co
            ErrorLog logs/domain3-error_log
            CustomLog logs/domain3-access_log common

        <Directory "/var/www/html/domain3">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>

        </VirtualHost>

Welcome.conf

        <LocationMatch "^/+$">
        Options Indexes +FollowSymLinks
        ErrorDocument 403 /error/noindex.html
        </LocationMatch>

Issue:

abc.in works fine when we go to https://abc.in shows directory listing instead of showing same content when we visit abc.in.

Highly appreciated your help

1

There are 1 answers

0
Vijay On BEST ANSWER

I have found answer for my own questions !!

I have changed from

        <VirtualHost IP:443>
        ServerAdmin [email protected]
        DirectoryIndex index.php
        DocumentRoot "/var/www/html/abc.in"
        ServerName www.abc.in
        ServerAlias abc.in
        ErrorLog logs/abc.in-error_log
        CustomLog logs/abc.in-access_log common
        ServerAlias abc.in
        <Directory "/var/www/html/abc.in">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all
        </Directory>
        </VirtualHost>

to

<VirtualHost *:443>
        ServerAdmin [email protected]
        #DirectoryIndex index.php
        DocumentRoot "/var/www/html/smartrx.in"
        ServerName www.abc.in
        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
        SSLCertificateFile /path/certificate.crt
        SSLCertificateKeyFile /path/certificate.key
        SSLCertificateChainFile /path/keychain.crt
        ServerAlias abc.in
        ErrorLog logs/abc.in-error_log
        CustomLog logs/abc.in-access_log common

        <Directory "/var/www/html/abc.in">
        Options Includes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
        </Directory>
        </VirtualHost>

Key changes : removed IP and included SSL related items and in Options removed Indexes commented all items in welcome.conf