LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache2, virtual host problems (https://www.linuxquestions.org/questions/linux-software-2/apache2-virtual-host-problems-174719/)

rjcrews 04-26-2004 10:55 AM

apache2, virtual host problems
 
Hi Im trying to use 2 domains from the same ip, i added this to etc/httpd/conf/vhosts/Vhosts.conf

NameVirtualHost *:80

<VirtualHost *:80>
ServerName ww.topone.com
ServerAlias topone.com *.toponecom
DocumentRoot /var/www/html/websites/topone
ErrorLog logs/topone.com-error_log
TransferLog logs/topone.com-access_log
</VirtualHost>

<VirtualHost *:80>
ServerName ww.bottom.net
ServerAlias bottom.net *.bottom.net
DocumentRoot /var/www/html/
ErrorLog logs/bottom.com-error_log
TransferLog logs/bottom.com-access_log
</VirtualHost>


I also added
VirtualDocumentRoot /etc/httpd/conf/vhosts/Vhosts.conf

to httpd.conf

For some reason topone does not work. It doesnt seem like its using the virtual hosts at all. i checked the apache 2 documentation and that is what it said to do. im obviously missing something, any help is appreciated, thanks. 2 w's bc it wouldnt let me post urls.

r

david_ross 04-26-2004 01:08 PM

Any errors in your access logs?

Does the domain resolve to the right IP when you dig it?

rjcrews 04-26-2004 10:04 PM

yea thanks for the reply, both of them go to the same place, /var/html/www. didnt see anything in the error logs, i think becuase there arent any errors. the dig results in both of them having an ip from the nameserver.

I dont know how to make one go somewhere else. Any ideas?
thanks again.

r

gwroy20 04-26-2004 11:24 PM

Does this problem occur on a local network, or does it only not work on the Internet?

rjcrews 04-27-2004 06:35 AM

both. I feel like i am missing something simple here. Is there something i can do to make sure apache is using the Vhosts.conf file? there is an include file in the httpd.conf, but according to the apache documentation it should be working i think. there is an example one on the server and i do not have it exactly like that:

NameVirtualHost 111.222.33.44
#<VirtualHost 111.222.33.44>
#ServerName www.domain.tld
#ServerPath /domain
#DocumentRoot /web/domain
#</VirtualHost>



Thanks for the help,
r

rjcrews 04-27-2004 06:36 AM

oops, the top line is commented out. #NameVirtualHost 111.222.33.44

Matt Collier 04-27-2004 03:58 PM

you only need the VirtualDocumentRoot directive for mod_vhost_alias, to dynamically add or remove vhosts without having to reload apache

all you need to do is
Include /etc/httpd/conf/vhosts/Vhosts.conf

in your main httpd.conf

as long as each virtualhost belongs to a NameVirtualHost directive, and it has it's own ServerName and DocumentRoot, it should be fine

rjcrews 04-28-2004 07:10 AM

thanks a lot for the help, i finally got it working. still not sure what the problem was, i cleaned up the httpd.conf file and i thnk that helped.

r

Tiago Cruz 05-19-2004 09:29 AM

Hei Friend!!!

I have the some problem, in Mandrake 9.1 with Apache 2.x

How you resolved this? Cleaning ALL inside httpd2.conf?

Thanks a lot!!! :D

rjcrews 05-21-2004 07:28 PM

yea i got it resolved, lemme know if you want to see my the file i am using now.

rjcrews 05-21-2004 07:38 PM

well actually i rewrote it, but somehow it had added some crap bc i was using webmin, stuff it added wasnt right i dont think.

Tiago Cruz 05-24-2004 09:38 AM

Thaks to reply! :D

It's complicade :(

[root@terra var]# tail -f /var/log/httpd/onec/error_log
[Wed May 19 11:39:08 2004] [error] [client 200.207.125.206] client denied by server configuration: /var/www/onec/
[Wed May 19 11:41:19 2004] [error] [client 200.207.125.206] client denied by server configuration: /var/www/onec/

What's this now?
The server _have_ permission on directory (chmod 777 -R)

[root@terra var]# cat /etc/httpd/conf/vhosts/Vhosts.conf
NameVirtualHost 200.207.125.206

<VirtualHost 200.207.125.206>
ServerAdmin tiagocruz@linuxdicas.com.br
DocumentRoot /var/www/radio
ServerName www.radionumber1.com.br
ErrorLog /var/log/httpd/radionumber1/error_log
TransferLog /var/log/httpd/radionumber1/access_log
<Directory "/var/www/radio">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


<VirtualHost 200.207.125.206>
#User apache
#Group apache
ServerAdmin tiagocruz@linuxdicas.com.br
DocumentRoot /var/www/onec
ServerName www.onec.org.br
ErrorLog /var/log/httpd/onec/error_log
TransferLog /var/log/httpd/onec/access_log
ScriptAlias /cgi-bin/ /var/www/onec/cgi-bin/
<Directory "/var/www/onec">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

===================

The apache config:

[root@terra var]# cat /etc/httpd/conf/httpd2.conf
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot "/var/www/radio"


### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

AddType audio/x-mpegurl .m3u

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
##LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
##LoadModule mime_magic_module modules/mod_mime_magic.so
##LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
##LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
##LoadModule proxy_connect_module modules/mod_proxy_connect.so
##LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
##LoadModule cgid_module modules/mod_cgid.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
##LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

##New Modules for 2.0 (some are experimental)
##LoadModule file_cache_module modules/mod_file_cache.so
##LoadModule echo_module modules/mod_echo.so
##LoadModule charset_lite_module modules/mod_charset_lite.so
##LoadModule cache_module modules/mod_cache.so
##LoadModule disk_cache_module modules/mod_disk_cache.so
##LoadModule mem_cache_module modules/mod_mem_cache.so
##LoadModule ext_filter_module modules/mod_ext_filter.so
##LoadModule case_filter_module modules/mod_case_filter.so
##LoadModule case_filter_in_module modules/mod_case_filter_in.so
##LoadModule deflate_module modules/mod_deflate.so
##LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
##LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
##LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
##LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
##LoadModule bucketeer_module modules/mod_bucketeer.so
##LoadModule logio_module modules/mod_logio.so

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
# For Apache2 we load all conf files in conf.d
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the
# cgi or php files

#BindAddress *
<IfDefine APACHEPROXIED>
Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
Listen 80
# Listen 81
</IfDefine>

# Likewise, we can set apache as the server by default and send perl
# requests via ProxyPass to apache-mod_perl. It increases performance
# since the perl interpreter is only used for perl and the standard apache
# does all the html and image files, with a smaller footprint.
#
# If you install apache and apache-mod_perl, this is the default config.
# If you don't want two web servers to use perl, uninstall apache, and
# apache-mod_perl will not be proxied.

<IfDefine PERLPROXIED>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^(.*\/perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
RewriteRule ^(.*\/cgi-perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
</IfModule>
</IfDefine>

###
### Log configuration Section
###

<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf


###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15


# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>


===================


You (s) see some problem?


:newbie:

Tiago Cruz :(
Thanks in Advance!

rjcrews 05-25-2004 08:11 PM

havent had time to look over yours throughly, sry. lemme post my virtual hosts and ill give it a look.


NameVirtualHost *:80

<VirtualHost *:80>
ServerName thorne.zoast.com
ServerAlias t.zoast.com *t.zoast.com
DocumentRoot /home/t/www
ErrorLog logs/t.zoast.com-error_log
TransferLog logs/t.zoast.com-access_log
</VirtualHost>

<VirtualHost *:80>
ServerName c.zoast.com
ServerAlias c.zoast.net *.c.zoast.net
DocumentRoot /home/r/www
ErrorLog logs/c.zoast.com-error_log
TransferLog logs/c.zoast.com-access_log
</VirtualHost>

<VirtualHost *:80>
ServerName www.zoast.com
ServerAlias zoast.com *.zoast.com
DocumentRoot /var/www/html
ErrorLog logs/zoast.com-error_log
TransferLog logs/zoast.com-access_log
</VirtualHost>

<VirtualHost *:80>
ServerName www.d.com
ServerAlias d.com *.d.com
DocumentRoot /home/d/www
ErrorLog logs/d.com-error_log
TransferLog logs/d.com-access_log
</VirtualHost>

<VirtualHost *:80>
ServerName www.actonexploration.com
ServerAlias actonexploration.com *.actonexploration.com
DocumentRoot /var/www/html/actonexploration
ErrorLog logs/actonexploration.com-error_log
TransferLog logs/actonexploration.com-access_log
</VirtualHost>

some of the sites arent really active atm , so i removed them. and there is the include file like you have yours included.

Include conf/vhosts/Vhosts.conf

lemme look yours over, dunno if i can help though.

rjcrews 05-25-2004 08:16 PM

hrm i dont know a whole lot, here are some things i have a little different you might try:

<IfDefine !APACHEPROXIED>
Port 80
Listen 80
</IfDefine>

and


NameVirtualHost 192.168.1.101


again im not sure how you have things set up and how you are on network etc.. good luck with it though. looks like from your error you may have some permissions problems.


All times are GMT -5. The time now is 05:18 PM.