1

I am running CentOS release 6.4 (Final) on my server and I have the following problem.

I have an Apache 2.2.15 installation running perfectly, but then I added another virtual host to the configuration so as to have two different sites: one on port 80 and another one on port 8090.

I have checked that Apache is listening in both ports, the configuration is done properly, I added the Listen directive and both NameVirtualHosts, one for every port. Both ports are opened on IPTables and granted access on SELinux.

I also restarted and ensured that the right configuration is applying.

The problem is that wen I try to access:

http://servername:8090

it shows the page configured for the site on

http://servername:80

Any idea of what may be happening?

If you need it, I can post the parts of the config files.

Virtual Hosts Config

Listen 80
Listen 8090

NameVirtualHost *:80
NameVirtualHost *:8090


<VirtualHost *:8090>
        ServerAdmin admin@a.com
        DocumentRoot /var/www/y/public_html
        ServerName a.com
        ErrorLog /var/www/y/error_log
        CustomLog /var/www/y/access_log common

        <directory /var/www/y/public_html>

                RewriteEngine On
                RewriteBase /
                RewriteRule ^index\.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.php [L]

        </directory>


</VirtualHost>



 <VirtualHost *:80>
     ServerAdmin admin@a.com
     DocumentRoot /var/www/x/web
     ServerName a.com
     ErrorLog /var/www/x/logs/error_log
     CustomLog /var/www/x/logs/access_log common

     <directory /var/www/x/web>

         Options -MultiViews
         RewriteEngine On
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteRule ^ index.php [QSA,L]

         AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/xml text/javascript application/javascript application/x-javascript

     </directory>

</VirtualHost>
  • May it be that SELinux redirect all ports in the http group to the port 80? – Studiosi Aug 3 '15 at 14:38
  • And your VirtualHost entries include port numbers in their configuration such as in the example, no .htacces files doing redirects? – HBruijn Aug 3 '15 at 14:39
  • 1
    No .htaccess, all config is done on the httpd.conf file. The virtual hosts are in the form <VirtualHost *:80> and <VirtualHost *:8090> – Studiosi Aug 3 '15 at 14:40
  • 1
    That's what I like to see :) but I have no obvious ideas – HBruijn Aug 3 '15 at 14:43
  • Without more knowledge about your system, perhaps any rewrite rules or the paths you're pointing to (maybe your document roots are the same or you're using symlinks that point to the same site?) We don't have access to your configuration, so we can't really troubleshoot your question. See serverfault.com/help/how-to-ask. You can, of course, redact any sensitive information, as long as you replace it with dummy values if they're an important part of the problem. – austinian Aug 3 '15 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.