![]() |
|
|
|
|
|||||||
| Web & Network Services Discussion related to network/web services such as apache, bind, sendmail, etc. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi, so I want to get my webserver working so that I can access by for instance
www.TestServer.com instead of 192.168.1.255 (e.g.) However after editing the httpd.conf file to include Code:
etc/apache22/extra/httpd-vhosts.conf As far as I know the hosts file is ok, here it is just in case - Code:
::1 localhost localhost.com 127.0.0.1 test.TestServer.com TServer 127.0.0.1 localhost.TestServer.com 192.168.1.233 TestServer.com TServer 192.168.1.233 TestServer.com Code:
NameVirtualHost 192.168.1.233:8080
<VirtualHost 192.168.1.233:8080>
ServerAdmin root@TestServer.com
DocumentRoot "/usr/local/www/TestServer"
ServerName TestServer.com
ServerAlias TestServer.com TServer
ErrorLog /usr/local/www/logs/TestServer-error_log
CustomLog /usr/local/www/logs/TestServer-access_log combined
</VirtualHost>
#Note this virtual host is not used and is here as a template
#<VirtualHost 192.168.1.233:8080>
#ServerAdmin root@d.example.com
#DocumentRoot "/usr/local/www/example.com
#ServerName example.com
#ServerAlias www.example.com
#ErrorLog /usr/local/www/logs/example-error_log
#CustomLog /usr/local/www/logs/example-access_log combined
#</VirtualHost>
|
|
#2
|
|||
|
|||
|
Note something else which I find odd is I cannot ping 127.0.0.1 but I can ping my IP address (192.168.1.255 (manually set))
|
|
#3
|
|||
|
|||
|
Oops apologies, should be .233, but I can't edit my posts or delete them so I have had to post again! Sorry.
|
|
#4
|
||||
|
||||
|
Quote:
No amount of editing in httpd.conf will make that hostname available to other machines.
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#5
|
||||
|
||||
|
Firewall settings?
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#6
|
|||
|
|||
|
As far as I know there isn't a firewall installed, or at least not one that I have configured? Is one automatically installed for FreeBsd? With regards to the DNS server, what is the easiest way to get it working locally (i.e. on the local network but without outside access). Can I run a DNS server on the machine which is acting as the web server, I know this may be bad practice to put them in the same place but would it work?
Quote:
Lastly, what is the quickest way I will be able to access the web server using a name even if it is simply restricted to my local network (192.168.1.x) Thanks |
|
#7
|
||||
|
||||
|
Add the hostname to the hosts file on all the client machines. Remember it's the client that does the resolving, not the webserver.
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#8
|
|||
|
|||
|
On all the client machines .....:S! Good point forgot that, though usually a DNS server does it, if I want to setup DNS on the machine is it a lengthy/tricky process? Or is it simply a matter of installing the DNS program from ports and putting an entry in its config file? What is the main DNS program used for this btw! Thanks!
|
|
#9
|
||||
|
||||
|
Bind is the standard DNS server and it's even included with the Base OS. There's a slightly newer version in the ports and there are also alternatives to bind.
It's a bit tricky to setup, you really need to know how DNS works. OTOH there are numerous howtos floating around on the internet that will guide you through it.
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#10
|
||||
|
||||
|
Change this back in /etc/hosts:
Code:
127.0.0.1 localhost localhost.my.domain
__________________
FreeBSD Handbook | FreeBSD Manuals | FAQ FreeBSD 6/7 | FreeBSD Wiki | FreeBSD Forum FAQ (Rules & Tips) Always use CODE tags for posting system output! | End-of-Year Fundraising Drive | Donate! ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#11
|
|||
|
|||
|
Thanks for that, I was looking at my windows hosts file and realised that my Unix one was pretty messy and didn't look right! Thanks for the pointer
|
|
#12
|
|||
|
|||
|
With regards to pinging the local host (127.0.0.1 (home...)) I still can't seem to do it and as far as I know I don't have a custom firewall installed! Any ideas on why it might not work/
here is the error - Code:
ping localhost PING 127.0.0.1 (127.0.0.1): 56 data bytes ping: sendto: Can't assign requested address |
|
#13
|
||||
|
||||
|
Does a straight
ping 127.0.0.1 work? What's the output of ifconfig lo0?
__________________
FreeBSD Handbook | FreeBSD Manuals | FAQ FreeBSD 6/7 | FreeBSD Wiki | FreeBSD Forum FAQ (Rules & Tips) Always use CODE tags for posting system output! | End-of-Year Fundraising Drive | Donate! ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#14
|
|||
|
|||
|
The result of a straight ping is shown below -
Code:
%ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes ping: sendto: Can't assign requested address ping: sendto: Can't assign requested address ping: sendto: Can't assign requested address ping: sendto: Can't assign requested address Code:
%ifconfig lo0
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
|
|
#15
|
||||
|
||||
|
You don't have the address 127.0.0.1 assigned to lo0 (or anywhere on your system). I'm surprised your system even works like that
Does it come back after a reboot?Make sure you have this in /etc/defaults/rc.conf (which you should never edit): Code:
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
__________________
FreeBSD Handbook | FreeBSD Manuals | FAQ FreeBSD 6/7 | FreeBSD Wiki | FreeBSD Forum FAQ (Rules & Tips) Always use CODE tags for posting system output! | End-of-Year Fundraising Drive | Donate! ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#16
|
||||
|
||||
|
Odd indeed, lo0 does have the correct IPv6 address (::1)
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#17
|
|||
|
|||
|
Hey, just checked the defaults rc.conf file and yes that line is there! Also looking at that file there is not a firewall enabled so that can't be the problem as far as I can tell.
|
|
#18
|
|||
|
|||
|
Just in case it is of any use, here is the rc.conf file (located at /etc/rc.conf)
Code:
# -- sysinstall generated deltas -- # Wed Oct 28 14:00:19 2009 # Created: Wed Oct 28 14:00:19 2009 # Enable network daemons for user convenience. # Please make all changes to this file, not to /etc/defaults/rc.conf. # This file now contains just the overrides from /etc/defaults/rc.conf. keymap="uk.cp850" linux_enable="YES" sshd_enable="YES" saver="snake" mysql_enable="YES" apache22_enable="YES" font8x8="cp437-8x8" font8x14="cp437-8x14" font8x16="cp437-8x16" moused_port="/dev/psm0" moused_type="auto" moused_enable="YES" hald_enable="YES" dbus_enable="YES" gdm_enable="YES" gnome_enable="YES" samba_enable="YES" hostname=RinicomTestServer.com # -- sysinstall generated deltas -- # Mon Nov 2 13:46:37 2009 defaultrouter="192.168.1.1" network_interfaces=fxp0 Name_server 192.168.0.1 ifconfig_fxp0="inet 192.168.1.233 netmask 255.255.255.0" |
|
#19
|
|||
|
|||
|
Also here is the entry from the defaults rc.conf file -
Code:
#cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config. ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check #autobridge_bridge0="tap* vlan0" # Interface glob to automatically add to the bridge # # If you have any sppp(4) interfaces above, you might also want to set # the following parameters. Refer to spppcontrol(8) for their meaning. sppp_interfaces="" # List of sppp interfaces. #sppp_interfaces="isp0" # example: sppp over ISDN #spppconfig_isp0="authproto=chap myauthname=foo myauthsecret='top secret' hisauthname=some-gw hisauthsecret='another secret'" gif_interfaces="" # List of GIF tunnels. #gif_interfaces="gif0 gif1" # Examples typically for a router. # Choose correct tunnel addrs. #gifconfig_gif0="10.1.1.1 10.1.2.1" # Examples typically for a router. #gifconfig_gif1="10.1.1.2 10.1.2.2" # Examples typically for a router. fec_interfaces="" # List of Fast EtherChannels. #fec_interfaces="fec0 fec1" #fecconfig_fec0="fxp0 dc0" # Examples typically for two NICs #fecconfig_fec1="em0 em1 bge0 bge1" # Examples typically for four NICs |
|
#20
|
||||
|
||||
|
I think the problems are these. Put quotes around the hostname and network_interface. Also remove that Name_server line.
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
|
#21
|
|||
|
|||
|
Quote:
Code:
# -- sysinstall generated deltas -- # Wed Oct 28 14:00:19 2009 # Created: Wed Oct 28 14:00:19 2009 # Enable network daemons for user convenience. # Please make all changes to this file, not to /etc/defaults/rc.conf. # This file now contains just the overrides from /etc/defaults/rc.conf. keymap="uk.cp850" linux_enable="YES" sshd_enable="YES" saver="snake" mysql_enable="YES" apache22_enable="YES" font8x8="cp437-8x8" font8x14="cp437-8x14" font8x16="cp437-8x16" moused_port="/dev/psm0" moused_type="auto" moused_enable="YES" hald_enable="YES" dbus_enable="YES" gdm_enable="YES" gnome_enable="YES" samba_enable="YES" hostname="RinicomTestServer.com" # -- sysinstall generated deltas -- # Mon Nov 2 13:46:37 2009 defaultrouter="192.168.1.1" network_interfaces="fxp0" #Name_server 192.168.0.1 ifconfig_fxp0="inet 192.168.1.233 netmask 255.255.255.0" Code:
ERROR: Error connecting to SMTP server "localhost:25".Server error: (49) Can't assign requested address |
|
#22
|
||||
|
||||
|
Ow.. Wait.. Remove that whole network_interfaces line or add lo0 to it.
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
| The Following User Says Thank You to SirDice For This Useful Post: | ||
jackocurly0074 (November 5th, 2009) | ||
|
#23
|
|||
|
|||
|
erm.... right, if I'm going to add lo0 to it what is the correct syntax??
network_interfaces="fxp0","lo0" or network_interfaces="fxp0,lo0" |
|
#24
|
|||
|
|||
|
I deleted the line and everything appears to work fine! Thanks very much, you guys are most helpful folk
|
|
#25
|
||||
|
||||
|
Quote:
Code:
network_interfaces="fxp0 lo0"
__________________
Oliver's Law: Experience is something you don't get until just after you need it. |
![]() |
| Tags |
| "httpd-vhosts.conf", "virtual hosts", namevirtualhost |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| /etc/hosts getting overwritten after reboot? | mrab54 | Networking | 2 | May 30th, 2009 21:42 |
| Jails vs. Virtual Hosts | cwhitmore | Web & Network Services | 1 | April 15th, 2009 20:37 |
| Sendmail resolving global MX, not from /etc/hosts | Phliplip | Web & Network Services | 2 | March 24th, 2009 15:55 |
| [Solved] Correct way to set up /etc/hosts | rota | Installing & Upgrading | 5 | March 19th, 2009 20:39 |
| Database Storage of Apache Virtual Hosts | Enter4 | Web & Network Services | 2 | January 8th, 2009 12:12 |