Ubuntu Server 8.10 + Apache 2.2.9 + Virtual Hosts [RESOLVED]

  • jammer2552
  • Graduate
  • Graduate
  • User avatar
  • Posts: 139

Post 3+ Months Ago

Right, so here's what I've got.

Ubuntu Server 8.10 running Apache 2.2, with the modem configured for DDNS (http://remotejcnet.homeip.net).

Now, I would like to have multiple sites on the one server, so we turn to Virtual Hosts. I have read many tutorials, but I believe the way my Apache was installed causes me some issues. (Thx aptitude)

Apache uses apache2.conf as its main configuration file, and here are the contents of that:
Code: [ Select ]
 
ServerRoot "/etc/apache2"
ServerName jcserv
ServerAdmin MY_EMAIL@yahoo.com
 
LockFile /var/lock/apache2/accept.lock
PidFile /var/run/apache2.pid
 
TimeOut 300
KeepAlive on
MaxKeepAliveRequests 100
KeepAliveTimeout 15
 
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>
 
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
 
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
 
AccessFileName .htaccess
 
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>
 
DefaultType text/plain
 
HostNameLookups off
 
ErrorLog /var/log/apache2/error.log
LogLevel warn
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
 
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
 
Include /etc/apache2/ports.conf
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
Include /etc/apache2/awstats.conf
 
Alias /error/include/ "/your/include/path/"
 
Alias /error/ "/usr/share/apache2/error/"
 
    <Directory "/usr/share/apache2/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en cs de es fr it nl sv pt-br ro
        ForceLanguagePriority Prefer Fallback
    </Directory>
 
    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    ErrorDocument 404 /error/HTTP_NOT_FOUND.php
    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    ErrorDocument 410 /error/HTTP_GONE.html.var
    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
 
    DocumentRoot /var/www/remotejcnet.homeip.net
 
 
  1.  
  2. ServerRoot "/etc/apache2"
  3. ServerName jcserv
  4. ServerAdmin MY_EMAIL@yahoo.com
  5.  
  6. LockFile /var/lock/apache2/accept.lock
  7. PidFile /var/run/apache2.pid
  8.  
  9. TimeOut 300
  10. KeepAlive on
  11. MaxKeepAliveRequests 100
  12. KeepAliveTimeout 15
  13.  
  14. <IfModule mpm_prefork_module>
  15.     StartServers          5
  16.     MinSpareServers       5
  17.     MaxSpareServers      10
  18.     MaxClients          150
  19.     MaxRequestsPerChild   0
  20. </IfModule>
  21.  
  22. <IfModule mpm_worker_module>
  23.     StartServers          2
  24.     MaxClients          150
  25.     MinSpareThreads      25
  26.     MaxSpareThreads      75
  27.     ThreadsPerChild      25
  28.     MaxRequestsPerChild   0
  29. </IfModule>
  30.  
  31. User ${APACHE_RUN_USER}
  32. Group ${APACHE_RUN_GROUP}
  33.  
  34. AccessFileName .htaccess
  35.  
  36. <Files ~ "^\.ht">
  37.     Order allow,deny
  38.     Deny from all
  39. </Files>
  40.  
  41. DefaultType text/plain
  42.  
  43. HostNameLookups off
  44.  
  45. ErrorLog /var/log/apache2/error.log
  46. LogLevel warn
  47. LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
  48. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  49. LogFormat "%h %l %u %t \"%r\" %>s %b" common
  50. LogFormat "%{Referer}i -> %U" referer
  51. LogFormat "%{User-agent}i" agent
  52. CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
  53.  
  54. Include /etc/apache2/mods-enabled/*.load
  55. Include /etc/apache2/mods-enabled/*.conf
  56.  
  57. Include /etc/apache2/ports.conf
  58. Include /etc/apache2/conf.d/
  59. Include /etc/apache2/sites-enabled/
  60. Include /etc/apache2/awstats.conf
  61.  
  62. Alias /error/include/ "/your/include/path/"
  63.  
  64. Alias /error/ "/usr/share/apache2/error/"
  65.  
  66.     <Directory "/usr/share/apache2/error">
  67.         AllowOverride None
  68.         Options IncludesNoExec
  69.         AddOutputFilter Includes html
  70.         AddHandler type-map var
  71.         Order allow,deny
  72.         Allow from all
  73.         LanguagePriority en cs de es fr it nl sv pt-br ro
  74.         ForceLanguagePriority Prefer Fallback
  75.     </Directory>
  76.  
  77.     ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
  78.     ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
  79.     ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
  80.     ErrorDocument 404 /error/HTTP_NOT_FOUND.php
  81.     ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
  82.     ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
  83.     ErrorDocument 410 /error/HTTP_GONE.html.var
  84.     ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
  85.     ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
  86.     ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
  87.     ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
  88.     ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
  89.     ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
  90.     ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
  91.     ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
  92.     ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
  93.     ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
  94.  
  95.     DocumentRoot /var/www/remotejcnet.homeip.net
  96.  
  97.  


Right now I have it running with only the default host running, so it works when you go to http://remotejcnet.homeip.net/, and the code for that is as follows:
Code: [ Select ]
 
<VirtualHost *>
 DocumentRoot /var/www/remotejcnet.homeip.net
 <Directory "/var/www/remotejcnet.homeip.net">
  allow from all
  Options +Indexes
 </Directory>
</VirtualHost>
 
  1.  
  2. <VirtualHost *>
  3.  DocumentRoot /var/www/remotejcnet.homeip.net
  4.  <Directory "/var/www/remotejcnet.homeip.net">
  5.   allow from all
  6.   Options +Indexes
  7.  </Directory>
  8. </VirtualHost>
  9.  


What I would like to do is add another domain to my DynDns.Org account and have the webserver serve a different page.

Thank you in advance to those that help, or at least try, to get this to work. :)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Have you tried following these examples?

http://httpd.apache.org/docs/2.2/vhosts/examples.html
  • jammer2552
  • Graduate
  • Graduate
  • User avatar
  • Posts: 139

Post 3+ Months Ago

Yes, I have. And I wonder something, since I have ServerName and DocumentRoot in my main apache2.conf, would that affect the operability of the Virtual Hosts?
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Take anything that has to do with a site/virtual-host out of apache2.conf, that's not how you do it on Ubuntu.

For every site you want to add, create a aptly named file in the following directory, include the sites directives in that file, and wrap those directives in a <VirtualHost> container.
Code: [ Select ]
/etc/apache2/sites-available


See this line in your apache2.conf file ?
Code: [ Select ]
Include /etc/apache2/sites-enabled/


That will load the virtual host(s) you want to enable if you create a link pointing to the file you created for the virtualhost in /sites-available.

Every single directive that configures a host, such as DocumentRoot or ServerAdmin, should be contained within a <VirtualHost> container. You should not have any of those directoves outside of a container.
  • jammer2552
  • Graduate
  • Graduate
  • User avatar
  • Posts: 139

Post 3+ Months Ago

joebert, I love you. :D

http://remotejcnet.homeip.net/
http://jameschurchard.com/
http://krista.kicks-ass.net/

All hosted with Virtual Hosts. :D

Thank you very much. ^_^
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Sure thing.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 94 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.