# apache + squid trouble



## neo_leopard (May 23, 2009)

i try to instal videocache 1.9.1 and i have to install apache. when i finished install it i get this error.

httpd: apr_sockaddr_info_get() failed for
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


i finished installing squid. and i havent seen any error on my log. i allready add 'squid_enable="YES"' on my rc.conf but why its still not loaded automatic when its restart.


----------



## anomie (May 23, 2009)

neo_leopard said:
			
		

> httpd: apr_sockaddr_info_get() failed for
> httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName



Provide a "hostort" value for Apache web server's ServerName directive. (You may also need to add an /etc/hosts entry for it if it does not exist in your DNS.)



			
				neo_leopard said:
			
		

> i finished installing squid. and i havent seen any error on my log. i allready add 'squid_enable="YES"' on my rc.conf but why its still not loaded automatic when its restart.



What happens if you try to start it manually? 

`# /usr/local/etc/rc.d/squid start`


----------



## neo_leopard (May 23, 2009)

i allready change my httpd.conf. its say syntax ok. but when i see look at my http log i get this string.

[Sun May 24 01:26:16 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun May 24 01:26:16 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ""
Configuration Failed

what should i do next?

when i run my squid normally it works. the problem is it wont start *automatically after restart*. eventough i allready write 
	
	



```
squid_enable="YES"
```
 in _/etc/rc.conf_


----------



## anomie (May 23, 2009)

neo_leopard said:
			
		

> ```
> [Sun May 24 01:26:16 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
> [Sun May 24 01:26:16 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ""
> ```



Please post the results, _in code tags_, of: 

 `# hostname`
 `# ifconfig`
 `# egrep -i 'listen|servername' /usr/local/etc/apache2/httpd.conf` (replace with correct path)
 `# dig <your hostname here>`
 `# cat /etc/hosts`



			
				neo_leopard said:
			
		

> when i run my squid normally it works. the problem is it wont start *automatically after restart*. eventough i allready write
> 
> 
> 
> ...



By "run [your] squid normally" you mean using the command I posted, right? If not, try that command. If so, check `# dmesg -a` and search for chatter about squid for clues.


----------



## neo_leopard (May 24, 2009)

your command result


```
# hostname

# ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:0c:f1:7f:4e:cd
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
vlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 00:0c:f1:7f:4e:cd
        inet 192.168.100.102 netmask 0xfffffffc broadcast 192.168.100.103
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 34 parent interface: em0
# egrep -i 'listen|servername' /usr/local/etc/apache22/httpd.conf
# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to
#Listen 12.34.56.78:80
Listen 80
# ServerName gives the name and port that the server uses to identify itself.
ServerName 192.168.100.102:80
# dig 192.168.100.102

; <<>> DiG 9.4.2 <<>> 192.168.100.102
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 29944
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;192.168.100.102.               IN      A

;; Query time: 1 msec
;; SERVER: 192.168.100.101#53(192.168.100.101)
;; WHEN: Sun May 24 08:33:20 2009
;; MSG SIZE  rcvd: 33

# cat /etc/hosts
# $FreeBSD: src/etc/hosts,v 1.16 2003/01/28 21:29:23 dbaker Exp $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
#
# Imaginary network.
#10.0.0.2               myname.my.domain myname
#10.0.0.3               myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers.  Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
192.168.100.102
```

i use for local only.


and about the squid i allready use that command and work perfectly. the problem is i can autorun it in the beginning of the box boot. when  i try demsg -a. it show nothing about squid at all.


----------



## anomie (May 24, 2009)

You're going to have to set a hostname for the box, and add an /etc/hosts entry. 

`# echo 'hostname="foo.local"' >> /etc/rc.conf`

`# echo '127.0.0.1 foo foo.local' >> /etc/hosts`

Then give it a try again.


----------



## neo_leopard (May 25, 2009)

im so sorry i did read your command :r

when i put that command it says command non found


----------



## anomie (May 25, 2009)

I am not sure I understand. Have you completed all the steps I mentioned? What problem(s) are you running into now? (i.e. "I tried exactly _this_ and _that_ happened.")


----------



## neo_leopard (May 25, 2009)

no its the squid problem. if the apache its works best :r. thanks. 

the problem is when 
# /usr/local/etc/rc.d/squid start

it say command not found


----------



## anomie (May 25, 2009)

neo_leopard said:
			
		

> if the apache its works best :r. thanks.



OK, Apache is working. Good news. 

Now for squid: 



			
				neo_leopard said:
			
		

> the problem is when
> # /usr/local/etc/rc.d/squid start
> 
> it say command not found



We can check where the rc script is by looking at the files associated with the package. (You installed squid from ports, right?) 

Please post the output of: 
`% pkg_info -L -x squid | grep 'rc'`


----------



## neo_leopard (May 25, 2009)

no im not. im not using ports


----------



## DutchDaemon (May 25, 2009)

Haven't we been through this whole ports thing before? Just use ports, or try a Squid forum if you insist on doing this the hard way. About 90% of people on this forum will give you advice based on using ports, and the other 10% based on using packages. The percentages may vary, but just downloading and installing tarballs 'somewhere on your disk' and building them outside of the usual software framework so you can't find their executables, config files, logfiles, etc. will give you sub-optimal replies.


----------



## anomie (May 25, 2009)

neo_leopard said:
			
		

> no im not. im not using ports



The (best) options you have are to write your own rc script, or to instead install from ports. 

The former would be reinventing the wheel, frankly. Please back up your squid.conf, remove the squid installation, and install from ports instead. 

It really will make things easier for you to maintain in the long run.


----------

