Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i've just inherited a server ubuntu 10.04 running already tomcat on port 80.so apache 2 /etc/apache2/ports.conf has Listen 8858.

i pointed my subdomain let's say admin.domain.com to the ip of that box so xx.xx.xx.xx:8858 and admin.domain.com:8858 both sends me to the root file "it works"

so i did create under /var/www/vhots/admin.domain.com/htdocs and /var/www/vhots/admin.domain.com/log my first config looks is below and that basically after reloading and restarting the apache2 gives me this error

VirtualHost *:8858 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results httpd (pid 7466?) not running

###/etc/apache2/apache2.cong
NameVirtualHost *
#NameVirtualHost *:8858
<VirtualHost *>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</Virtualhost>


###/etc/apache2/sites-available/admin.domain.com
<VirtualHost *:8858>
    ServerAdmin sensei@domain.com
    ServerName admin.domain.com
    ServerAlias www.admin.domain.com

    DocumentRoot /var/www/vhots/admin.domain.com/htdocs
            <Directory /var/www/vhosts/admin.domain.com/htdocs>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>


    ErrorLog /var/www/vhosts/admin.domain.com/log/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/www/vhosts/admin.domain.com/log/access.log combined
    ServerSignature On
  </VirtualHost>

So after reading this i've uncommented NameVirtualHost *:8858 that i initially put there making me have both NameVirtualHost * and NameVirtualHost *:8858 now i have a warn message but then the server refuse to start

NameVirtualHost *:8858 has no VirtualHosts httpd (pid 27536?) not running [warn] NameVirtualHost *:8858 has no VirtualHosts [fail]

How can i get it up? Thanks for reading this

share|improve this question

2 Answers 2

If you already have a Tomcat running on port 80, you can't attach Apache to same port. HTTP URL without a port, like http://admin.domain.com, assumes the port is 80.

So, in order to make your site accessible without a port (:8858) you'd need to move Tomcat to another port.

There's another solution if you have 2 IP addresses on the same server, for example x.x.x.1 and x.x.x.2. Then point Tomcat to first address and Apache to second with:

# Apache configuration
NameVirtualHost x.x.x.2:80

<VirtualHost x.x.x.2:80>
 #Your site configuration
</virtualHost>

In that case don't forget to repoint your DNS entries to correctly.

share|improve this answer
    
thanks for clarifying things up. No i don't have a second ip.So i will do with 8858.Now any clue on how to get the virtualhost up? –  black sensei Aug 1 '12 at 10:13
    
Just remove VirtualHost * configuration and NameVirtualHost *. Uncomment NameVirtualHost *:8858 and that should be it. –  Patko Aug 1 '12 at 11:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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