2

I have an apache2 server on Ubuntu 14.04 with 2 sites on different ports: site1.domain.com -> Port 80 site2.domain.com -> Port 8888

http://site1.domain.com -> OK
http://site2.domain.com:8888 -> OK
http://site1.domain.com:8888 -> Also OK

I wonder site1 only on port 80 and site2 only on port 8888.

My: ports.conf are:

Listen 8888 

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
   Listen 443
</IfModule>
Listen 80    

The site1 has:

<VirtualHost *:80>

And the site2 has:

<VirtualHost *:8888>

TIA

3
  • I am not entirely sure, but did you add the NameVirtualHost option in your config?
    – eKKiM
    Sep 15, 2015 at 17:14
  • posting your full config file on gist and pasting a link here might help
    – chicks
    Sep 15, 2015 at 19:44
  • Side note, just in case you didn't know -- you don't have to use separate ports for different sites hosted on the same system -- you can set the website name in the virtual configuration, and have them both use port 80.
    – Tim S.
    Sep 15, 2015 at 21:25

1 Answer 1

2

Do you have each in its own file in /etc/apache2/sites-available and a symbolic link to /etc/apache2/sites-enabled/ ?

site1.conf

<VirtualHost *:80>
    DocumentRoot /dir/dir/
    ServerName site1.domain.com
    <Directory /dir/dir/>
    allow from all
    Options +Indexes
    </Directory>
    <Directory "/dir/dir/cgi-bin">
    </Directory> ScriptAlias /cgi-bin/ /dir/dir/cgi-bin/
</VirtualHost>

site2.conf

<VirtualHost *:8888>
    DocumentRoot /dir/dir/
    ServerName site2.domain.com
    <Directory /dir/dir/>
    allow from all
    Options +Indexes
    </Directory>
    <Directory "/dir/dir/cgi-bin">
    </Directory> ScriptAlias /cgi-bin/ /dir/dir/cgi-bin/
</VirtualHost>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.