|
Home > Archive > Red Hat Networking > January 2004 > Apache & VirtualHosts
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Apache & VirtualHosts
|
|
| R.Gunn 2004-01-23, 7:33 pm |
| Firstly, apoligies for the crosspost - I posted this to 2 newsgroups
yesterday and one hasnt even shown up yet and hasnt updated since before I
posted - so I am trying again....
Hi.
I am having teething problems with Apache2.0 running on RH9:
I can see the "Apache configuration error" page (error 404 replacement) when
I hit the server but cannot get it to view pages I put into /var/www/html.
I saw a reference to an "apache" user and group - do I need to create these
first? How do I then grant access rights only to the /var/www/html folder
(or do I have to give it more rights than that).
I have also setup 4 virtual hosts using dyndns.com and have used the GUI
configurator for apache to include these. To start with all of them showed
the same 404 replacement file. Now when I try I get an error saying pages
are secure and to use https:// to access them rather than http://. Is this
because they are running on port 81 rather than 80? (reason being I am
accessing from outside using a router and the company website is already
running on a separate webserver on port 80!). I dont recall what I did
before this happened so any advice here would also be great - or is it
because its port 81 and not 80?!
Error page:
-----starts-----
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Hint: https://rgunn.shacknet.nu:81/
--
-----ends-----
I have since discovered that the https:// problems start after enabling Name
based Virtual host... doing IP based does not cause the problem (although I
dont want IP based!).
Can anyone help me with this please?
---
Richard Gunn, G7UDG
Thanks for your help!
[Please remove the obvious if replying direct]
| |
| R.Gunn 2004-01-23, 7:33 pm |
| >:oI
I see big circles approaching! ;o)
The problem I have is not so much the port numbering issue; I understand
that - but why force https on port 81 when I want http on port 81. Yes the
config file says to listen on port 81 - but not for https - for http. I
never changed 443 to 81 at all.
And, why only to the https enforcement when I turn name based virtual hosts
on - why not do it all the time.
I never had this problem configuring virtual hosts in Apache for Win32
(running WIndows2000) - the only problem there was file path for some
reason - I had to get rid og the var/www or (whatever it was then) and
replace with full c:\inetpub\wwwroot\apache\... path (don't know why - but
it worked after that!)
Cheers! (more help please!!?)

Richard
"Maurits van de Kamp" <james.t.kirk@enterprise.nasa.gov> wrote in message
news:bfgcts$emd$1@reader10.wxs.nl...quote:
> R.Gunn wrote:
>
>
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
>
> It's not that confusing.. "https" really means something else than
> (just) the port. https:// tells your browser to use the secure
> http-protocol instead of the normal one. *By default*, the https service
> listens on port 443 (just like normal http listens to port 80 by
> default). But if you put it on port 81, it's on 81.
>
> So, https://shrike:81 tells your browser to use the https protocol and
> try it on port 81. https://shrike tells the browser to use https
> protocol on port 443. http://shrike:81 tells the browser to use the
> *normal* http protocol on 81. http://shrike tells the browser to use the
> normal http protocol on port 80.
>
> See? 
>
> Maurits.
>
| |
| R.Gunn 2004-01-23, 7:33 pm |
| Superb! Thanks Jim. I learnt a lot from that... don't use the GUI frontend
being the prime point!!!
By following your points:
1. I did not do.
2. I played with for some time with different varients (see below
---snip---
#
# Use name-based virtual hosting.
#
NameVirtualHost 192.168.0.5
# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts
# Logs
# Virtual hosts
#
# Virtual host Default Virtual Host
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel debug
HostNameLookups off
</VirtualHost>
# Virtual host rgunn-shacknet-nu
<VirtualHost 192.168.0.5>
DocumentRoot "/var/www/html/shacknet"
DirectoryIndex index.htm index.html
ServerName rgunn.shacknet.nu
ServerAlias shacknet
</VirtualHost>
# Virtual host gunns-homelinux-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/homelinux
DirectoryIndex index.html
ServerName gunns.homelinux.net
</VirtualHost>
# Virtual host doesthis-serveftp-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/serveftp
DirectoryIndex index.htm
ServerName doesthis.serveftp.net
</VirtualHost>
---snip---
Whilst restarting the service from the command prompt I got to see errors
(which I did not see when the same settings were there after a GUI restart).
These errors led me to ((a.) modify my hosts file as you suggest in 1. -
which removed one error; (b.) Notice that "NameVirtualHost" directive (as
prompted in an error line and as you point out) was not defined with my IP -
rather with a * which isn't too clever)
3. Was already done.
I know the DirectoryIndex changes on each setting - I was also playing with
this setup to see if it did actually make any difference. NOT having the
DirectoryIndex directive in place caused the default "Apache Test Page" to
display (error 404) although it wasn't added by the GUI when stting up
virtualhosts.
My "use https://" message no longer appears either which is nice.
I am now going to follow the rest of your points from 4 onwards to see what
happens there.
I should now be able to visit my host from "outside" with any luck....
Next problem will be to track the dynamic IP address I get at home. I have
been using NO-IP at home on Win32 with a programme to update my IP; and am
using DynDns at work (for testing) for the above 4 URLs... I am hoping 1 of
these 2 can be used with RH9 to track my IP on that... maybe you have any
advice on what to do here? I looked on DynDns.org for Linux software but
there were so many i didnt know what to do!
So much to learn!
Thanks again for your great advice.
Richard
"Jim Fischer" <jfischer_link5809@now.here.com> wrote in message
news:DCWSa.35$R27.32@fe01.atl2.webusenet.com...quote:
> R.Gunn wrote:
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
use[QUOTE][color=darkred]
be[QUOTE][color=darkred]
but[QUOTE][color=darkred]
screens[QUOTE][color=darkred]
visit[QUOTE][color=darkred]
doing[QUOTE][color=darkred]
(to[QUOTE][color=darkred]
>
> Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
> guess as to why this is happening. If you want to email me a copy of
> your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
> be an Apache expert...)
>
>
> FWIW, I just tried the following on my Red Hat 9 box and it seemed to
> work for me:
>
> 1) I appended the following items to /etc/hosts
>
> 127.1.0.1 curly curly.localdomain
> 127.1.0.1 moe moe.localdomain
>
>
> 2) I added the virtual hosts config settings shown below to the end of
> my 'httpd.conf' file.
>
> [n.b. I am using the httpd.conf file that was provided with the httpd
RPM.]quote:
>
> --- start ---
> #
> # Name Virtual hosts setup
> #
>
> NameVirtualHost 127.1.0.1
>
> <VirtualHost 127.1.0.1>
> ServerName curly.localdomain
> ServerAlias curly
> DocumentRoot "/var/www/curly/html"
> ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
> </VirtualHost>
>
> <VirtualHost 127.1.0.1>
> ServerName moe.localdomain
> ServerAlias moe
> DocumentRoot "/var/www/moe/html"
> ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
> </VirtualHost>
>
> #
> # IP Virtual hosts setup
> #
>
> # -- no IP Virtual hosts yet --
>
> --- end ---
>
>
> 3) In httpd.conf I changed the following directives:
>
> #Listen 80
> Listen 81
> ...
> #ServerName glob.localdomain:80
> ServerName glob.localdomain:81
>
> [n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
>
>
> 4) After I saved the httpd.conf changes to disk, I verified the syntax
> of the httpd.conf file and obtained a listing of the virtual hosts setup:
>
> [root]# httpd -t -D DUMP_VHOSTS
> VirtualHost configuration:
> 127.1.0.1:* is a NameVirtualHost
> default server curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost moe.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1068)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
> Syntax OK
>
>
> 5) I created the directory trees for the 'curly' and 'moe' virtual
> domains, and placed some test files in those directories:
>
> [root]# ... blah blah blah ...
> [root]# cd /var/www
> [root]# tree curly moe
> curly
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
> moe
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
>
> 4 directories, 4 files
>
> -- */cgi-bin/first.pl --
> #! /usr/bin/perl -w
> print "Content-type: text/html\n\n";
> print "$0\n";
>
> -- */html/index.html --
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/{curly|moe}/html/index.html</P>
> </BODY>
> </HTML>
>
>
> 6) I restarted the Apache web server
>
> [root]# service httpd restart
>
>
> 7) I tested it out:
>
> [root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:50:31 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> Content-Length: 30
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> /var/www/moe/cgi-bin/first.pl
>
>
> [root]# lynx -mime_header http://curly.localdomain:81/
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:52:02 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> {...}
> Content-Length: 335
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/curly/html/index.html</P>
> </BODY>
> </HTML>
>
>
> --
> Jim
>
> To reply by email, remove "link" and change "now.here" to "yahoo"
> jfischer_link5809{at}now.here.com
>
>
| |
| Jim Fischer 2004-01-23, 7:33 pm |
| R.Gunn wrote:quote:
> If I do http://shrike:81 I get the "bad request" page above telling me to
> use https://shrike:81 - which is very confusing as https:// should be port
> 443 surely. If I then do visit https://shrike:81 I do get my "root" html
> index page I created.
>
> If I switch OFF all my "named virtual host" I no longer get forced to use
> https:// and can then use http:// as normal (all port 81 still).
>
> I can visit http://shrike:81/shacknet to get the index page that should be
> displayed when visiting http://rgunn.shacknet.nu:81 with no problem - but
> cannot visit it from the "outside" (dyndns supplied) address.
>
> If you don't mind, I have screenshots of the various configuration screens
> and resulting browser windows I could private mail to you..?
>
> To summarise, I think, WITHOUT name based virtual hosts running I can visit
> my default home page at http://shrike:81 with no problem. Switching on
> name-based virtual hosts forces me to use https://shrike:81 to view my
> default home page; and none of the virtual hosts work either.
>
> For testing purposes (although I have tried without the hosts file and doing
> it "online"), I have made the following modification to my HOSTS file (to
> save me dialling up to test the external addresses all the time):
>
> 192.168.0.5 doesthis.serveftp.net
> 192.168.0.5 gunns.homelinux.net
> 192.168.0.5 rgunn.shacknet.nu
Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
guess as to why this is happening. If you want to email me a copy of
your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
be an Apache expert...)
FWIW, I just tried the following on my Red Hat 9 box and it seemed to
work for me:
1) I appended the following items to /etc/hosts
127.1.0.1 curly curly.localdomain
127.1.0.1 moe moe.localdomain
2) I added the virtual hosts config settings shown below to the end of
my 'httpd.conf' file.
[n.b. I am using the httpd.conf file that was provided with the httpd RPM.]
--- start ---
#
# Name Virtual hosts setup
#
NameVirtualHost 127.1.0.1
<VirtualHost 127.1.0.1>
ServerName curly.localdomain
ServerAlias curly
DocumentRoot "/var/www/curly/html"
ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
</VirtualHost>
<VirtualHost 127.1.0.1>
ServerName moe.localdomain
ServerAlias moe
DocumentRoot "/var/www/moe/html"
ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
</VirtualHost>
#
# IP Virtual hosts setup
#
# -- no IP Virtual hosts yet --
--- end ---
3) In httpd.conf I changed the following directives:
#Listen 80
Listen 81
...
#ServerName glob.localdomain:80
ServerName glob.localdomain:81
[n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
4) After I saved the httpd.conf changes to disk, I verified the syntax
of the httpd.conf file and obtained a listing of the virtual hosts setup:
[root]# httpd -t -D DUMP_VHOSTS
VirtualHost configuration:
127.1.0.1:* is a NameVirtualHost
default server curly.localdomain \
(/etc/httpd/conf.d/virtual-hosts.conf:1061)
port * namevhost curly.localdomain \
(/etc/httpd/conf.d/virtual-hosts.conf:1061)
port * namevhost moe.localdomain \
(/etc/httpd/conf.d/virtual-hosts.conf:1068)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
Syntax OK
5) I created the directory trees for the 'curly' and 'moe' virtual
domains, and placed some test files in those directories:
[root]# ... blah blah blah ...
[root]# cd /var/www
[root]# tree curly moe
curly
|-- cgi-bin
| `-- first.pl
`-- html
`-- index.html
moe
|-- cgi-bin
| `-- first.pl
`-- html
`-- index.html
4 directories, 4 files
-- */cgi-bin/first.pl --
#! /usr/bin/perl -w
print "Content-type: text/html\n\n";
print "$0\n";
-- */html/index.html --
<HTML>
<HEAD> </HEAD>
<BODY>
<P>/var/www/{curly|moe}/html/index.html</P>
</BODY>
</HTML>
6) I restarted the Apache web server
[root]# service httpd restart
7) I tested it out:
[root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
HTTP/1.1 200 OK
Date: Mon, 21 Jul 2003 18:50:31 GMT
Server: Apache/2.0.40 (Red Hat Linux)
Content-Length: 30
Connection: close
Content-Type: text/html; charset=ISO-8859-1
/var/www/moe/cgi-bin/first.pl
[root]# lynx -mime_header http://curly.localdomain:81/
HTTP/1.1 200 OK
Date: Mon, 21 Jul 2003 18:52:02 GMT
Server: Apache/2.0.40 (Red Hat Linux)
{...}
Content-Length: 335
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<HTML>
<HEAD> </HEAD>
<BODY>
<P>/var/www/curly/html/index.html</P>
</BODY>
</HTML>
--
Jim
To reply by email, remove "link" and change "now.here" to "yahoo"
jfischer_link5809{at}now.here.com
| |
| R.Gunn 2004-01-23, 7:33 pm |
| Superb! Thanks Jim. I learnt a lot from that... don't use the GUI frontend
being the prime point!!!
By following your points:
1. I did not do.
2. I played with for some time with different varients (see below
---snip---
#
# Use name-based virtual hosting.
#
NameVirtualHost 192.168.0.5
# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts
# Logs
# Virtual hosts
#
# Virtual host Default Virtual Host
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel debug
HostNameLookups off
</VirtualHost>
# Virtual host rgunn-shacknet-nu
<VirtualHost 192.168.0.5>
DocumentRoot "/var/www/html/shacknet"
DirectoryIndex index.htm index.html
ServerName rgunn.shacknet.nu
ServerAlias shacknet
</VirtualHost>
# Virtual host gunns-homelinux-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/homelinux
DirectoryIndex index.html
ServerName gunns.homelinux.net
</VirtualHost>
# Virtual host doesthis-serveftp-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/serveftp
DirectoryIndex index.htm
ServerName doesthis.serveftp.net
</VirtualHost>
---snip---
Whilst restarting the service from the command prompt I got to see errors
(which I did not see when the same settings were there after a GUI restart).
These errors led me to ((a.) modify my hosts file as you suggest in 1. -
which removed one error; (b.) Notice that "NameVirtualHost" directive (as
prompted in an error line and as you point out) was not defined with my IP -
rather with a * which isn't too clever)
3. Was already done.
I know the DirectoryIndex changes on each setting - I was also playing with
this setup to see if it did actually make any difference. NOT having the
DirectoryIndex directive in place caused the default "Apache Test Page" to
display (error 404) although it wasn't added by the GUI when stting up
virtualhosts.
My "use https://" message no longer appears either which is nice.
I am now going to follow the rest of your points from 4 onwards to see what
happens there.
I should now be able to visit my host from "outside" with any luck....
Next problem will be to track the dynamic IP address I get at home. I have
been using NO-IP at home on Win32 with a programme to update my IP; and am
using DynDns at work (for testing) for the above 4 URLs... I am hoping 1 of
these 2 can be used with RH9 to track my IP on that... maybe you have any
advice on what to do here? I looked on DynDns.org for Linux software but
there were so many i didnt know what to do!
So much to learn!
Thanks again for your great advice.
Richard
"Jim Fischer" <jfischer_link5809@now.here.com> wrote in message
news:DCWSa.35$R27.32@fe01.atl2.webusenet.com...quote:
> R.Gunn wrote:
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
use[QUOTE][color=darkred]
be[QUOTE][color=darkred]
but[QUOTE][color=darkred]
screens[QUOTE][color=darkred]
visit[QUOTE][color=darkred]
doing[QUOTE][color=darkred]
(to[QUOTE][color=darkred]
>
> Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
> guess as to why this is happening. If you want to email me a copy of
> your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
> be an Apache expert...)
>
>
> FWIW, I just tried the following on my Red Hat 9 box and it seemed to
> work for me:
>
> 1) I appended the following items to /etc/hosts
>
> 127.1.0.1 curly curly.localdomain
> 127.1.0.1 moe moe.localdomain
>
>
> 2) I added the virtual hosts config settings shown below to the end of
> my 'httpd.conf' file.
>
> [n.b. I am using the httpd.conf file that was provided with the httpd
RPM.]quote:
>
> --- start ---
> #
> # Name Virtual hosts setup
> #
>
> NameVirtualHost 127.1.0.1
>
> <VirtualHost 127.1.0.1>
> ServerName curly.localdomain
> ServerAlias curly
> DocumentRoot "/var/www/curly/html"
> ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
> </VirtualHost>
>
> <VirtualHost 127.1.0.1>
> ServerName moe.localdomain
> ServerAlias moe
> DocumentRoot "/var/www/moe/html"
> ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
> </VirtualHost>
>
> #
> # IP Virtual hosts setup
> #
>
> # -- no IP Virtual hosts yet --
>
> --- end ---
>
>
> 3) In httpd.conf I changed the following directives:
>
> #Listen 80
> Listen 81
> ...
> #ServerName glob.localdomain:80
> ServerName glob.localdomain:81
>
> [n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
>
>
> 4) After I saved the httpd.conf changes to disk, I verified the syntax
> of the httpd.conf file and obtained a listing of the virtual hosts setup:
>
> [root]# httpd -t -D DUMP_VHOSTS
> VirtualHost configuration:
> 127.1.0.1:* is a NameVirtualHost
> default server curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost moe.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1068)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
> Syntax OK
>
>
> 5) I created the directory trees for the 'curly' and 'moe' virtual
> domains, and placed some test files in those directories:
>
> [root]# ... blah blah blah ...
> [root]# cd /var/www
> [root]# tree curly moe
> curly
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
> moe
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
>
> 4 directories, 4 files
>
> -- */cgi-bin/first.pl --
> #! /usr/bin/perl -w
> print "Content-type: text/html\n\n";
> print "$0\n";
>
> -- */html/index.html --
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/{curly|moe}/html/index.html</P>
> </BODY>
> </HTML>
>
>
> 6) I restarted the Apache web server
>
> [root]# service httpd restart
>
>
> 7) I tested it out:
>
> [root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:50:31 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> Content-Length: 30
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> /var/www/moe/cgi-bin/first.pl
>
>
> [root]# lynx -mime_header http://curly.localdomain:81/
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:52:02 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> {...}
> Content-Length: 335
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/curly/html/index.html</P>
> </BODY>
> </HTML>
>
>
> --
> Jim
>
> To reply by email, remove "link" and change "now.here" to "yahoo"
> jfischer_link5809{at}now.here.com
>
>
| |
| R.Gunn 2004-01-23, 7:33 pm |
| Superb! Thanks Jim. I learnt a lot from that... don't use the GUI frontend
being the prime point!!!
By following your points:
1. I did not do.
2. I played with for some time with different varients (see below
---snip---
#
# Use name-based virtual hosting.
#
NameVirtualHost 192.168.0.5
# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts
# Logs
# Virtual hosts
#
# Virtual host Default Virtual Host
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel debug
HostNameLookups off
</VirtualHost>
# Virtual host rgunn-shacknet-nu
<VirtualHost 192.168.0.5>
DocumentRoot "/var/www/html/shacknet"
DirectoryIndex index.htm index.html
ServerName rgunn.shacknet.nu
ServerAlias shacknet
</VirtualHost>
# Virtual host gunns-homelinux-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/homelinux
DirectoryIndex index.html
ServerName gunns.homelinux.net
</VirtualHost>
# Virtual host doesthis-serveftp-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/serveftp
DirectoryIndex index.htm
ServerName doesthis.serveftp.net
</VirtualHost>
---snip---
Whilst restarting the service from the command prompt I got to see errors
(which I did not see when the same settings were there after a GUI restart).
These errors led me to ((a.) modify my hosts file as you suggest in 1. -
which removed one error; (b.) Notice that "NameVirtualHost" directive (as
prompted in an error line and as you point out) was not defined with my IP -
rather with a * which isn't too clever)
3. Was already done.
I know the DirectoryIndex changes on each setting - I was also playing with
this setup to see if it did actually make any difference. NOT having the
DirectoryIndex directive in place caused the default "Apache Test Page" to
display (error 404) although it wasn't added by the GUI when stting up
virtualhosts.
My "use https://" message no longer appears either which is nice.
I am now going to follow the rest of your points from 4 onwards to see what
happens there.
I should now be able to visit my host from "outside" with any luck....
Next problem will be to track the dynamic IP address I get at home. I have
been using NO-IP at home on Win32 with a programme to update my IP; and am
using DynDns at work (for testing) for the above 4 URLs... I am hoping 1 of
these 2 can be used with RH9 to track my IP on that... maybe you have any
advice on what to do here? I looked on DynDns.org for Linux software but
there were so many i didnt know what to do!
So much to learn!
Thanks again for your great advice.
Richard
"Jim Fischer" <jfischer_link5809@now.here.com> wrote in message
news:DCWSa.35$R27.32@fe01.atl2.webusenet.com...quote:
> R.Gunn wrote:
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
use[QUOTE][color=darkred]
be[QUOTE][color=darkred]
but[QUOTE][color=darkred]
screens[QUOTE][color=darkred]
visit[QUOTE][color=darkred]
doing[QUOTE][color=darkred]
(to[QUOTE][color=darkred]
>
> Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
> guess as to why this is happening. If you want to email me a copy of
> your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
> be an Apache expert...)
>
>
> FWIW, I just tried the following on my Red Hat 9 box and it seemed to
> work for me:
>
> 1) I appended the following items to /etc/hosts
>
> 127.1.0.1 curly curly.localdomain
> 127.1.0.1 moe moe.localdomain
>
>
> 2) I added the virtual hosts config settings shown below to the end of
> my 'httpd.conf' file.
>
> [n.b. I am using the httpd.conf file that was provided with the httpd
RPM.]quote:
>
> --- start ---
> #
> # Name Virtual hosts setup
> #
>
> NameVirtualHost 127.1.0.1
>
> <VirtualHost 127.1.0.1>
> ServerName curly.localdomain
> ServerAlias curly
> DocumentRoot "/var/www/curly/html"
> ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
> </VirtualHost>
>
> <VirtualHost 127.1.0.1>
> ServerName moe.localdomain
> ServerAlias moe
> DocumentRoot "/var/www/moe/html"
> ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
> </VirtualHost>
>
> #
> # IP Virtual hosts setup
> #
>
> # -- no IP Virtual hosts yet --
>
> --- end ---
>
>
> 3) In httpd.conf I changed the following directives:
>
> #Listen 80
> Listen 81
> ...
> #ServerName glob.localdomain:80
> ServerName glob.localdomain:81
>
> [n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
>
>
> 4) After I saved the httpd.conf changes to disk, I verified the syntax
> of the httpd.conf file and obtained a listing of the virtual hosts setup:
>
> [root]# httpd -t -D DUMP_VHOSTS
> VirtualHost configuration:
> 127.1.0.1:* is a NameVirtualHost
> default server curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost moe.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1068)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
> Syntax OK
>
>
> 5) I created the directory trees for the 'curly' and 'moe' virtual
> domains, and placed some test files in those directories:
>
> [root]# ... blah blah blah ...
> [root]# cd /var/www
> [root]# tree curly moe
> curly
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
> moe
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
>
> 4 directories, 4 files
>
> -- */cgi-bin/first.pl --
> #! /usr/bin/perl -w
> print "Content-type: text/html\n\n";
> print "$0\n";
>
> -- */html/index.html --
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/{curly|moe}/html/index.html</P>
> </BODY>
> </HTML>
>
>
> 6) I restarted the Apache web server
>
> [root]# service httpd restart
>
>
> 7) I tested it out:
>
> [root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:50:31 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> Content-Length: 30
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> /var/www/moe/cgi-bin/first.pl
>
>
> [root]# lynx -mime_header http://curly.localdomain:81/
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:52:02 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> {...}
> Content-Length: 335
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/curly/html/index.html</P>
> </BODY>
> </HTML>
>
>
> --
> Jim
>
> To reply by email, remove "link" and change "now.here" to "yahoo"
> jfischer_link5809{at}now.here.com
>
>
| |
|
|
| R.Gunn 2004-01-23, 7:33 pm |
| Thanks for the detailed reply.
I'll me trying out your options over the next couple of hours and post a
reply with news back!
For information, save my modifications to reference port 81 and virtualhosts
my install is straight off the RH9 distro. CD.
Thanks again
Richard
"Jim Fischer" <jfischer_link5809@now.here.com> wrote in message
news:DCWSa.35$R27.32@fe01.atl2.webusenet.com...quote:
> R.Gunn wrote:
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
use[QUOTE][color=darkred]
be[QUOTE][color=darkred]
but[QUOTE][color=darkred]
screens[QUOTE][color=darkred]
visit[QUOTE][color=darkred]
doing[QUOTE][color=darkred]
(to[QUOTE][color=darkred]
>
> Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
> guess as to why this is happening. If you want to email me a copy of
> your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
> be an Apache expert...)
>
>
> FWIW, I just tried the following on my Red Hat 9 box and it seemed to
> work for me:
>
> 1) I appended the following items to /etc/hosts
>
> 127.1.0.1 curly curly.localdomain
> 127.1.0.1 moe moe.localdomain
>
>
> 2) I added the virtual hosts config settings shown below to the end of
> my 'httpd.conf' file.
>
> [n.b. I am using the httpd.conf file that was provided with the httpd
RPM.]quote:
>
> --- start ---
> #
> # Name Virtual hosts setup
> #
>
> NameVirtualHost 127.1.0.1
>
> <VirtualHost 127.1.0.1>
> ServerName curly.localdomain
> ServerAlias curly
> DocumentRoot "/var/www/curly/html"
> ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
> </VirtualHost>
>
> <VirtualHost 127.1.0.1>
> ServerName moe.localdomain
> ServerAlias moe
> DocumentRoot "/var/www/moe/html"
> ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
> </VirtualHost>
>
> #
> # IP Virtual hosts setup
> #
>
> # -- no IP Virtual hosts yet --
>
> --- end ---
>
>
> 3) In httpd.conf I changed the following directives:
>
> #Listen 80
> Listen 81
> ...
> #ServerName glob.localdomain:80
> ServerName glob.localdomain:81
>
> [n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
>
>
> 4) After I saved the httpd.conf changes to disk, I verified the syntax
> of the httpd.conf file and obtained a listing of the virtual hosts setup:
>
> [root]# httpd -t -D DUMP_VHOSTS
> VirtualHost configuration:
> 127.1.0.1:* is a NameVirtualHost
> default server curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost moe.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1068)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
> Syntax OK
>
>
> 5) I created the directory trees for the 'curly' and 'moe' virtual
> domains, and placed some test files in those directories:
>
> [root]# ... blah blah blah ...
> [root]# cd /var/www
> [root]# tree curly moe
> curly
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
> moe
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
>
> 4 directories, 4 files
>
> -- */cgi-bin/first.pl --
> #! /usr/bin/perl -w
> print "Content-type: text/html\n\n";
> print "$0\n";
>
> -- */html/index.html --
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/{curly|moe}/html/index.html</P>
> </BODY>
> </HTML>
>
>
> 6) I restarted the Apache web server
>
> [root]# service httpd restart
>
>
> 7) I tested it out:
>
> [root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:50:31 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> Content-Length: 30
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> /var/www/moe/cgi-bin/first.pl
>
>
> [root]# lynx -mime_header http://curly.localdomain:81/
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:52:02 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> {...}
> Content-Length: 335
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/curly/html/index.html</P>
> </BODY>
> </HTML>
>
>
> --
> Jim
>
> To reply by email, remove "link" and change "now.here" to "yahoo"
> jfischer_link5809{at}now.here.com
>
>
| |
| R.Gunn 2004-01-23, 7:33 pm |
| Superb! Thanks Jim. I learnt a lot from that... don't use the GUI frontend
being the prime point!!!
By following your points:
1. I did not do.
2. I played with for some time with different varients (see below
---snip---
#
# Use name-based virtual hosting.
#
NameVirtualHost 192.168.0.5
# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"
# Defaults for virtual hosts
# Logs
# Virtual hosts
#
# Virtual host Default Virtual Host
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel debug
HostNameLookups off
</VirtualHost>
# Virtual host rgunn-shacknet-nu
<VirtualHost 192.168.0.5>
DocumentRoot "/var/www/html/shacknet"
DirectoryIndex index.htm index.html
ServerName rgunn.shacknet.nu
ServerAlias shacknet
</VirtualHost>
# Virtual host gunns-homelinux-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/homelinux
DirectoryIndex index.html
ServerName gunns.homelinux.net
</VirtualHost>
# Virtual host doesthis-serveftp-net
<VirtualHost 192.168.0.5>
DocumentRoot /var/www/html/serveftp
DirectoryIndex index.htm
ServerName doesthis.serveftp.net
</VirtualHost>
---snip---
Whilst restarting the service from the command prompt I got to see errors
(which I did not see when the same settings were there after a GUI restart).
These errors led me to ((a.) modify my hosts file as you suggest in 1. -
which removed one error; (b.) Notice that "NameVirtualHost" directive (as
prompted in an error line and as you point out) was not defined with my IP -
rather with a * which isn't too clever)
3. Was already done.
I know the DirectoryIndex changes on each setting - I was also playing with
this setup to see if it did actually make any difference. NOT having the
DirectoryIndex directive in place caused the default "Apache Test Page" to
display (error 404) although it wasn't added by the GUI when stting up
virtualhosts.
My "use https://" message no longer appears either which is nice.
I am now going to follow the rest of your points from 4 onwards to see what
happens there.
I should now be able to visit my host from "outside" with any luck....
Next problem will be to track the dynamic IP address I get at home. I have
been using NO-IP at home on Win32 with a programme to update my IP; and am
using DynDns at work (for testing) for the above 4 URLs... I am hoping 1 of
these 2 can be used with RH9 to track my IP on that... maybe you have any
advice on what to do here? I looked on DynDns.org for Linux software but
there were so many i didnt know what to do!
So much to learn!
Thanks again for your great advice.
Richard
"Jim Fischer" <jfischer_link5809@now.here.com> wrote in message
news:DCWSa.35$R27.32@fe01.atl2.webusenet.com...quote:
> R.Gunn wrote:
to[QUOTE][color=darkred]
port[QUOTE][color=darkred]
html[QUOTE][color=darkred]
use[QUOTE][color=darkred]
be[QUOTE][color=darkred]
but[QUOTE][color=darkred]
screens[QUOTE][color=darkred]
visit[QUOTE][color=darkred]
doing[QUOTE][color=darkred]
(to[QUOTE][color=darkred]
>
> Hmmm... Without seeing your 'httpd.conf' file, it's really anyone's
> guess as to why this is happening. If you want to email me a copy of
> your httpd.conf file, I'll take a look at it. (Caveat: I don't claim to
> be an Apache expert...)
>
>
> FWIW, I just tried the following on my Red Hat 9 box and it seemed to
> work for me:
>
> 1) I appended the following items to /etc/hosts
>
> 127.1.0.1 curly curly.localdomain
> 127.1.0.1 moe moe.localdomain
>
>
> 2) I added the virtual hosts config settings shown below to the end of
> my 'httpd.conf' file.
>
> [n.b. I am using the httpd.conf file that was provided with the httpd
RPM.]quote:
>
> --- start ---
> #
> # Name Virtual hosts setup
> #
>
> NameVirtualHost 127.1.0.1
>
> <VirtualHost 127.1.0.1>
> ServerName curly.localdomain
> ServerAlias curly
> DocumentRoot "/var/www/curly/html"
> ScriptAlias /cgi-bin/ "/var/www/curly/cgi-bin/"
> </VirtualHost>
>
> <VirtualHost 127.1.0.1>
> ServerName moe.localdomain
> ServerAlias moe
> DocumentRoot "/var/www/moe/html"
> ScriptAlias /cgi-bin/ "/var/www/moe/cgi-bin/"
> </VirtualHost>
>
> #
> # IP Virtual hosts setup
> #
>
> # -- no IP Virtual hosts yet --
>
> --- end ---
>
>
> 3) In httpd.conf I changed the following directives:
>
> #Listen 80
> Listen 81
> ...
> #ServerName glob.localdomain:80
> ServerName glob.localdomain:81
>
> [n.b. In /etc/hosts: 127.0.0.1 glob glob.localdomain]
>
>
> 4) After I saved the httpd.conf changes to disk, I verified the syntax
> of the httpd.conf file and obtained a listing of the virtual hosts setup:
>
> [root]# httpd -t -D DUMP_VHOSTS
> VirtualHost configuration:
> 127.1.0.1:* is a NameVirtualHost
> default server curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost curly.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1061)
> port * namevhost moe.localdomain \
> (/etc/httpd/conf.d/virtual-hosts.conf:1068)
> wildcard NameVirtualHosts and _default_ servers:
> _default_:443 glob (/etc/httpd/conf.d/ssl.conf:90)
> Syntax OK
>
>
> 5) I created the directory trees for the 'curly' and 'moe' virtual
> domains, and placed some test files in those directories:
>
> [root]# ... blah blah blah ...
> [root]# cd /var/www
> [root]# tree curly moe
> curly
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
> moe
> |-- cgi-bin
> | `-- first.pl
> `-- html
> `-- index.html
>
> 4 directories, 4 files
>
> -- */cgi-bin/first.pl --
> #! /usr/bin/perl -w
> print "Content-type: text/html\n\n";
> print "$0\n";
>
> -- */html/index.html --
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/{curly|moe}/html/index.html</P>
> </BODY>
> </HTML>
>
>
> 6) I restarted the Apache web server
>
> [root]# service httpd restart
>
>
> 7) I tested it out:
>
> [root]# lynx -mime_header http://moe:81/cgi-bin/first.pl
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:50:31 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> Content-Length: 30
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> /var/www/moe/cgi-bin/first.pl
>
>
> [root]# lynx -mime_header http://curly.localdomain:81/
> HTTP/1.1 200 OK
> Date: Mon, 21 Jul 2003 18:52:02 GMT
> Server: Apache/2.0.40 (Red Hat Linux)
> {...}
> Content-Length: 335
> Connection: close
> Content-Type: text/html; charset=ISO-8859-1
>
> <HTML>
> <HEAD> </HEAD>
> <BODY>
> <P>/var/www/curly/html/index.html</P>
> </BODY>
> </HTML>
>
>
> --
> Jim
>
> To reply by email, remove "link" and change "now.here" to "yahoo"
> jfischer_link5809{at}now.here.com
>
>
|
|
|
|
|