OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [users@httpd] virtual host


On Fri, 28 Sep 2018 15:40:49 +0200, Sander Smeenk stated:

>Quoting Carmel NY (carmel_ny@xxxxxxxxxxx):
>
>> >Please elaborate on the 'not working out so well' bit.  
>
>> >> apachectl -S
>> >> VirtualHost configuration:
>> >> *:80                   stem.example.net
>> >> (/usr/local/etc/apache24/extra/httpd-vhosts.conf:24)
>> >> *:443                  example.net
>> >> (/usr/local/etc/apache24/extra/httpd-ssl.conf:121)    
>
>> Okay, on a stock FreeBSD installation, maybe on others too, there is an
>> index.html file in the document root that displays, "It Works" when it is
>> access. Now, when I type in my normal web address; http://example.net, the
>> vhost site is displayed. However, if I type in the vhost name;
>> http://stem.example.net, the regular site is display; ie. "It Works". That
>> is exactly opposite of what it is supposed to be doing. That make no sense,
>> so I know that I am doing something really wrong.  
>
>This is Apache 2.4.x ?
>
>I don't see the 'default server ...','ip.add.re.ss:port is a NameVirtualHost'
>and 'alias'-lines in your 'apache2ctl -S' output.
>
>Did you remove those yourself?  It always helps not to obfuscate your configs
>and logs when seeking help.
>
># apache2ctl -S
>VirtualHost configuration:
>213.154.236.176:443    is a NameVirtualHost
>   default server www.freshdot.net
> (/etc/apache2/sites-enabled/01.www.freshdot.net.conf:1) port 443 namevhost
> www.freshdot.net (/etc/apache2/sites-enabled/01.www.freshdot.net.conf:1)
> alias freshdot.net [ .. ]
>[2001:7b8:633:1:213:154:236:176]:443 is a NameVirtualHost
>   default server www.freshdot.net
> (/etc/apache2/sites-enabled/01.www.freshdot.net.conf:1) port 443 namevhost
> www.freshdot.net (/etc/apache2/sites-enabled/01.www.freshdot.net.conf:1)
> alias freshdot.net
>
>Apache will, by default, treat the first vhost definition it finds as
>the default vhost for that IP/port combo. Try defining a simple vhost
>before defining the stem.example.net vhost so that no longer is your
>default vhost.
>
>Regards,
>-Sndr.

I don't have an "apache2ctl" program. I do have an "apachectl" one though.
This is my output:

apachectl -S
VirtualHost configuration:
*:80   stem.example.net (/usr/local/etc/apache24/extra/httpd-vhosts.conf:24)
*:443  example.net (/usr/local/etc/apache24/extra/httpd-ssl.conf:121)
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80

httpd -V
Server version: Apache/2.4.35 (FreeBSD)
Server built:   unknown
Server's Module Magic Number: 20120211:82
Server loaded:  APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr/local"
 -D SUEXEC_BIN="/usr/local/bin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/apache_runtime_status"
 -D DEFAULT_ERRORLOG="/var/log/httpd-error.log"
 -D AP_TYPES_CONFIG_FILE="etc/apache24/mime.types"
 -D SERVER_CONFIG_FILE="etc/apache24/httpd.conf"


Now, in the httpd.conf file, I changed the "ServerName www.example.net:80" to
"ServerName example.net:80" and now the vhost appears to be working correctly.

So, it appears that my next challenge will be to get SSL working on the vhost.

Thanks for your help. I am sure I will be needing more shortly.

-- 
Carmel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx