cancel
Showing results for 
Search instead for 
Did you mean: 

Apache website hosting problem

henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Apache website hosting problem

Hi all
I bought a .co.uk domain name, changed name servers to everydns.net and created an A record to point my domain to my PlusNet IP address, waited 48hrs, checked nic.uk that replication had completed and updated the apache.conf file on my (Linux-based) QNAP TS-109 Pro NAS:-
-----------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerName http://www.domain1.co.uk
ServerAlias domain1.co.uk
DocumentRoot "/share/Qweb/domain1"
</VirtualHost>
-----------------
But when I enter my website (or IP address) from home I get my home router configuration webpage, instead of my website!  And I get "page cannot be displayed" from work.
Do I need to setup a port forwarding rule? Well I forwarded port 80 to the IP address of my TS-109 Pro but it made no difference at all.
Also, when I browse to the IP address of my TS-109 Pro, I get /share/Qweb/domain1/index.htm.
Any ideas where I am going wrong please?
Sad
Thanks
Scott
_________________
QNAP TS-109 Pro version 1.1.4 build 1207T
1TB Hitachi Deskstar HDS721010KLA330
BT Voyager 210 ADSL router
APC Back-UPS ES 700VA
Vista Ultimate 32-bit
5 REPLIES 5
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: Apache website hosting problem

First the problem accessing from your internal network. This will not work because most routers get confused if you try to use your routers external IP address internally and assume you are trying to access it internally so show the config screen. You need to set-up an entry in your hosts file for the domain name (and any sub-domains) to point to the internal IP of your webserver. So when you put www.domain.com in your browser, your local PC will use your internal IP address rather than the external one via a DNS lookup.
For your problem accessing it via work. You do need to forward port 80 on your router to the internal IP address of your web server.
Finally the conf file is wrong. http:// is never passed to the web server, it is used by the browser to determine the protocol it should use to connect with the URL given (http ftp etc). Try:
ServerName domain1.co.uk
ServerAlias www.domain1.co.uk
DocumentRoot "/share/Qweb/domain1/"
And remember to restart the apache service so it re-reads the conf file
Also you can try using httpd -S to verify the config file and any virtual Hosts defined. I suspect Apache may not actually be running if it detected a conf file error. Check the apache logs.
henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Re: Apache website hosting problem

Thanks for the prompt and helpful reply, Peter!
1) I have mapped the IP address of the NAS to my domain name in the C:\Windows\System32\drivers\etc\hosts file.  I now get an error when accessing my website internally "The requested URL / was not found on this server.  Apache/1.3.37 Server at www.domain1.co.uk Port 80"
2) I have forwarded port 80 to the IP address of the NAS (i.e. web server) and will test from work tomorrow morning.
3) I have updated the apache.conf file as per your advice.
4) I have restarted the apache service using "/etc/init.d/Qthttpd.sh restart"
5) How do I run the Httpd -S command?  I am getting to grips with WinSCP (Commands --> Open Terminal) and can restart the apache service ok but am not an Apache/Linux guru so struggling how to do this.  Any ideas please?
6) The apache_access_log is empty, but the apache_error_log reads "[Wed Jan  9 23:02:37 2008] [alert] apache: Could not determine the server's fully qualified domain name, using 192.168.*.* for ServerName
[Wed Jan  9 23:02:37 2008] [crit] (98)Address already in use: make_sock: could not bind to port 80"
Any further help would be most appreciated.
Many thanks
Scott
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: Apache website hosting problem

I'm not familiar with QNAP so can't really help as it looks like it may be using a modified apache install.
Normally from the shell prompt ($ or more likely # for root) on a Linux box you just run httpd -S where httpd is the apache binary but if the QNAP uses a different name for httpd that will not work.
If you have access to a shell prompt on the QNAT try ps xa to get a process listing and see if there are any httpd or similar programs running, then use that in place of httpd. It may actually be called qthttpd so try qthttpd -S.
You need to get it working when accessing internally before it is likely to work externally.
henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Re: Apache website hosting problem

ps xa worked fine from root and displayed the following:-
---------------------
  PID  Uid    VmSize Stat Command
    1 admin      540 S  init     
    2 admin          SWN [ksoftirqd/0]
    3 admin          SW< [events/0]
    4 admin          SW< [khelper]
    5 admin          SW< [kthread]
  11 admin          SW< [kblockd/0]
  14 admin          SW  [khubd]
  51 admin          SW  [pdflush]
  52 admin          SW  [pdflush]
  54 admin          SW< [aio/0]
  53 admin          SW  [kswapd0]
  56 admin          SW  [cifsoplockd]
  184 admin          SW  [scsi_eh_0]
  185 admin          SW  [scsi_eh_1]
  198 admin          SW  [mtdblockd]
  277 admin          SW  [kjournald]
  287 admin      624 S  /sbin/daemon_mgr
  336 admin          SW  [kjournald]
  375 admin          SW  [kjournald]
  400 admin      668 S  /sbin/hotswap
  404 admin      848 S  /sbin/hd_util
  413 admin      848 S  /sbin/hd_util
  414 admin      848 S  /sbin/hd_util
  422 admin      848 S  /sbin/hd_util
  508 admin      1784 S  /usr/local/sbin/thttpd -p 8081 -nor -nos -u admin -d
  523 admin      6940 S  /usr/local/apache/bin/apache
  524 guest      7092 S  /usr/local/apache/bin/apache
  525 guest      7092 S  /usr/local/apache/bin/apache
  526 guest      7088 S  /usr/local/apache/bin/apache
  527 guest      7088 S  /usr/local/apache/bin/apache
  528 guest      7092 S  /usr/local/apache/bin/apache
  543 admin      2828 S  /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/con
  544 admin      2820 S  /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/con
  547 admin      2232 S  /usr/local/samba/sbin/nmbd -l /var/log -D -s /etc/con
  554 guest      2988 S  proftpd: (accepting connections)
  565 admin      1004 S  /sbin/btd
  574 guest      772 S  /sbin/ImRd -d
  584 admin      640 S  /usr/sbin/crond -l 9
  607 admin      664 S  /usr/sbin/ntpdated
  613 admin      1504 S  /usr/sbin/stunnel /etc/stunnel/stunnel.conf
  628 admin      596 S  /sbin/recycled
  668 admin      772 R  /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
  683 admin      1412 S  /usr/sbin/sshd -f /etc/ssh/sshd_config -p 22
  696 admin      452 S  /mnt/HDA_ROOT/twonkymedia/twonkymedia -inifile /mnt/H
  697 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  709 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  710 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  711 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  712 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  713 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  714 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  715 admin      2240 S  /mnt/HDA_ROOT/twonkymedia/twonkymediaserver -inifile
  723 admin      1076 S  /sbin/bcclient
  724 admin      1076 S  /sbin/bcclient
  725 admin      1076 S  /sbin/bcclient
  734 admin      1076 S  /sbin/bcclient
  747 admin      792 S  /sbin/picd
  751 admin      728 S  /sbin/gpiod
  763 admin      892 S  /usr/bin/rsync --daemon
  764 admin      772 S  /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
  765 admin      772 S  /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
  833 admin      504 S  /sbin/getty 115200 ttyS0
  863 guest      7092 S  /usr/local/apache/bin/apache
  864 guest      7092 S  /usr/local/apache/bin/apache
  875 guest      7092 S  /usr/local/apache/bin/apache
  876 guest      7092 S  /usr/local/apache/bin/apache
  901 admin      3268 S  /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/con
  925 admin      2156 S  /usr/sbin/sshd -f /etc/ssh/sshd_config -p 22 -R
  926 admin      1036 S  -sh
  982 admin      628 R  ps xa
---------------------
I couldn't find Httpd but I did try "thttpd" and "Qthttpd", although without any success:-
---------------------
/usr/local/sbin$ thttpd -s
-sh: line 69: thttpd: command not found
/usr/local/sbin$ thttpd
-sh: line 71: thttpd: command not found
/usr/local/sbin$ Qthttpd
-sh: line 73: Qthttpd: command not found
/usr/local/sbin$ info Qthttpd
-sh: line 75: info: command not found
---------------------
1) Any ideas on where I go from here with the "httpd -S" command?
2) Well thx to you, I now have www.domain1.co.uk working internally.  Should I assume that now I have forwarded port 80 to the web server www.domain1.co.uk should also work externally?
Thanks
Scott
henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Re: Apache website hosting problem

Just remotely connected to work and tested website works perfectly!
That just leaves me to thank you Peter!
Much appreciated!!!
Scott
Grin