Webserver redirected to Admin Page

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
rimertis
New here
Posts: 2
Joined: Fri Feb 22, 2013 7:43 pm

Webserver redirected to Admin Page

Post by rimertis »

Hello,
I have activated the admin-Webserver with restriction to ssl only (Port 8081). Default-Port (8080) is redirected to 8081. This is what I want.
Then, I have activated the (Apache-)Webserver. http-Port is 80, https 8082. https works well. Nevertheless, http (port 80) is allways redirected to the admin-Server on port 8081. This persists after restauration/activation of the Restore-Default-Button on the Webserver administration interface and even after rebooting Qnap. There is no .htaccess-file in /share/Web (the apache-Servers root).
Any idea?

Fabio
GrassIsForCows
Starting out
Posts: 18
Joined: Fri Feb 08, 2013 3:59 am

Re: Webserver redirected to Admin Page

Post by GrassIsForCows »

This is done by the file /share/Web/index.php. When you replace that file with the first page of your website it will no longer redirect.
rimertis
New here
Posts: 2
Joined: Fri Feb 22, 2013 7:43 pm

Re: Webserver redirected to Admin Page

Post by rimertis »

Thanks
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Webserver redirected to Admin Page

Post by schumaku »

GrassIsForCows wrote:This is done by the file /share/Web/index.php. When you replace that file with the first page of your website it will no longer redirect.
I don't think so - this file shows the default Web page, providing some information on how to add content.

Almost convinced this is yet another case of an Apache not starting, and the QNAP NAS Admin process does take control off the Web port instead.

Double check the Web server port configuration in the Web UI.

[/] # getcfg QWEB Port
...
[/] # getcfg QWEB SSL_Port
...
[/] # getcfg QWEB Enable_SSL
...


Try to restart the Web server form the NAS Linux shell:

[/] # /etc/init.d/Qthttpd.sh restart

Post the output.
GrassIsForCows
Starting out
Posts: 18
Joined: Fri Feb 08, 2013 3:59 am

Re: Webserver redirected to Admin Page

Post by GrassIsForCows »

schumaku wrote:
GrassIsForCows wrote:This is done by the file /share/Web/index.php. When you replace that file with the first page of your website it will no longer redirect.
I don't think so - this file shows the default Web page, providing some information on how to add content.
Not on a new 212P II. Here's the content of the default /share/Web/index.php.

Code: Select all

<?php
	$webAccessPort = exec('/sbin/getcfg System "Web Access Port" -d 8080');
	$webAccessUrl = 'http://'.$_SERVER['SERVER_NAME'].':'.$webAccessPort.'/';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
<meta http-equiv="expires" content="0">
<script type='text/javascript'>
	location.href = '<?php print $webAccessUrl ?>';
</script>
	</head>
</html>
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Webserver redirected to Admin Page

Post by schumaku »

Ok, so replace it by whatever you want - it's your NAS, no need to keep the default index.php ...
rodmcban
Starting out
Posts: 20
Joined: Wed Apr 08, 2009 9:45 pm

I am having the same problem

Post by rodmcban »

Webserver always redirects to admin page on a fresh "Reset to factory defaults" 509 TS

I replaced index.php in /share/Qweb, still does it.

Restarted Qthttpd as suggested by Schumaku and I am getting this error:

/share/Qweb] # /etc/init.d/Qthttpd.sh restart
Shutting down Qthttpd services: OK.
df: /share/external/UHCI Host Controller: Protocol error
df: /share/external/UHCI Host Controller: Protocol error
df: /share/external/UHCI Host Controller: Protocol error
df: /share/external/UHCI Host Controller: Protocol error
Starting Qthttpd services: Qthttpd.

Any other ideas ?
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Webserver redirected to Admin Page

Post by schumaku »

Web server is enabled at all? Newer QTS versions seem to capture the Web server port if disabled - here is the code issued when telnet to the Web server port and do a GET / :

[~] # telnet localhost 80
GET /
<html><head><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="expires" content="0"><script>
if(location.hostname.indexOf(':') == -1){location.href='http://'+location.hostname+':'+8080+'/';
}else{location.href='http://['+location.hostname+']:'+8080+'/';}
</script></head></html>
Connection closed by foreign host.

To make the confusion complete: Even with the Web Server serivce disabled on the NAS ... there is no indication when stop/start/restart the Web server from the command line ...:

[~] # /sbin/getcfg "QWEB" "Enable"
0
[~] # /etc/init.d/Qthttpd.sh restart
Shutting down Qthttpd services: OK.
Starting Qthttpd services: Qthttpd.
[~] #

With the Web Server enabled, the default index.php does jump in - similar test:

[~] # telnet localhost 80
GET /
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="expires" content="0">
<script type='text/javascript'>
location.href = 'http://10.10.1.109:8080/';
</script>
</head>
</html>Connection closed by foreign host.

QNAP does - in an attempt to keep things user friendly - not make things simple and transparent enough here ... just my opinion.
aktiveradio
New here
Posts: 3
Joined: Tue Apr 09, 2013 8:35 am

Re: Webserver redirected to Admin Page

Post by aktiveradio »

I seem to have the same issue my Virtual host always seem to redirect to port 8080 did you ever find a solution to this?
LittleNo
Starting out
Posts: 12
Joined: Sat Dec 24, 2011 10:09 pm

Re: Webserver redirected to Admin Page

Post by LittleNo »

Same here, with Virtual Hosts I always end up at the QNAP Interface, not the directory it should be.

I already replaced the index.php by a blank page but it still does that redirection.

My case is still a bit more complex, because I want the webserver-HTTPS on port 443, directed to my virtual hosts, to keep every traffic in HTTPS without having to manually use a port in the address-line.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Webserver redirected to Admin Page

Post by schumaku »

LittleNo wrote: My case is still a bit more complex, because I want the webserver-HTTPS on port 443, directed to my virtual hosts, to keep every traffic in HTTPS without having to manually use a port in the address-line.
This does not cause any issues - works here like a charm, ie. on a TS-212, QTS 4.2.0 20151118 - Web Server https 443, two virtual Web servers on 443 - all are reachable, no redirect. QTS https is active on 4433, and http on 8080.

From what I'm aware, QNAP does launch a dedicated daemon just redirecting the standard Web ports to the QTS ports ... at least under some conditions. Have temporarily disabled the Web server on the above configuration, however this process is not launched here.

PS. Sorry LittleNo ... somehow some rewrites are going mad, the quote is corrupted (but correct :ubergeek: ).
LittleNo
Starting out
Posts: 12
Joined: Sat Dec 24, 2011 10:09 pm

Re: Webserver redirected to Admin Page

Post by LittleNo »

hmm, well, in my configuration it simply does not work. Do you have the option "accept only HTTPS connection" for the admin-interface set?
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Webserver redirected to Admin Page

Post by schumaku »

LittleNo wrote:Do you have the option "accept only HTTPS connection" for the admin-interface set?
This could make a difference - have not exposed the non-https ports. Long before I would consider to disable the non-http access. :mrgreen:

Can you please provide a full process list of your NAS? (Windows PuTTY resp. OS X Terminal, make it as wide as possible, and run # ps -ef ... copy-paste the full output.

Does /etc/config/uLinux.conf look "healthy" in the structure ([sections] line line line ....)? No duplicates? The QWEB section about similar to the following?

[QWEB]
Enable = 1
Port = 80
Enable_SSL = 1
SSL_Port = 443
ExtPort = 0
ExtSSLPort = 0
Enable_WebDAV = 1
Enable_User_Permission = 1
LittleNo
Starting out
Posts: 12
Joined: Sat Dec 24, 2011 10:09 pm

Re: Webserver redirected to Admin Page

Post by LittleNo »

PID Uid VmSize Stat Command
1 admin 464 S init
2 admin SW [kthreadd]
3 admin SW [ksoftirqd/0]
6 admin SW< [khelper]
7 admin SW [kworker/u:1]
135 admin SW [sync_supers]
137 admin SW [bdi-default]
138 admin SW< [kblockd]
144 admin SW< [ata_sff]
154 admin SW [khubd]
156 admin SW [kethubd]
161 admin SW< [md]
254 admin DW [kswapd0]
255 admin SW [fsnotify_mark]
257 admin SW< [crypto]
356 admin SW [scsi_eh_0]
359 admin SW [scsi_eh_1]
362 admin SW [kworker/u:2]
370 admin SW< [orion_spi]
378 admin SW [mtdblock0]
382 admin SW [mtdblock1]
386 admin SW [mtdblock2]
390 admin SW [mtdblock3]
394 admin SW [mtdblock4]
398 admin SW [mtdblock5]
399 admin SW [flush-9:0]
423 admin SW< [deferwq]
450 admin SW [flush-1:0]
620 admin SW [md9_raid1]
657 admin SW [md13_raid1]
741 admin SW [kjournald]
1122 admin 412 S /sbin/daemon_mgr.nvr
1169 admin SW< [dm-block-clone]
1189 admin SW [mv_crypto]
1202 admin SW< [cryptodev_queue]
1235 admin SW< [rpciod]
1242 admin SW< [nfsiod]
1249 admin SW< [cifsiod]
1260 admin SW [fnotify]
1267 admin SW< [cfg80211]
1285 admin 376 S < qWatchdogd: keeping alive every 1 seconds...
1713 admin SW [kjournald]
1844 admin 204 S /sbin/modagent
1865 admin SW [md2_raid1]
1885 admin 100 S /sbin/kerrd
1960 admin SW [md0_raid1]
2015 admin SW [jbd2/md0-8]
2016 admin SW< [ext4-dio-unwrit]
2128 admin 612 S /sbin/hotswap
2131 admin 416 S /sbin/qsmartd -d
2893 admin 448 S /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults
3236 admin 3016 S /usr/local/mariadb/bin/mysqld --defaults-file=/usr/lo
3307 admin 592 S /sbin/qpkgd -d0
3454 admin 972 S N /usr/local/medialibrary/bin/mymediadbserver -e -n -t
3739 admin 264 S /usr/local/medialibrary/bin/mysystemcmdsvr -d
3775 admin 684 S N /usr/local/medialibrary/bin/myidbserver -n -d
3862 admin 488 S /usr/local/medialibrary/bin/mytranscodesvr -u -d -db
3935 admin 1168 S /usr/local/medialibrary/bin/myupnpmediasvr -d
3965 admin 364 S /usr/sbin/SCREEN -dmS QAIRP /mnt/ext/opt/apache/bin/p
3968 admin 1224 S /mnt/ext/opt/apache/bin/php /usr/local/medialibrary/b
3975 admin 976 S /usr/bin/qDmcd
3976 admin 664 S /usr/local/medialibrary/bin/qRPlayerCenter
3977 admin 636 S /usr/local/sbin/remote_folder_daemon --reset
4066 admin 396 S /usr/sbin/SCREEN -dmS QAIRP /mnt/ext/opt/apache/bin/p
4069 admin 1548 S /mnt/ext/opt/apache/bin/php /usr/local/medialibrary/b
4132 httpdusr 444 S /sbin/lpb_scheduler -d
4158 admin 456 S /sbin/genthd
4398 guest 524 S /usr/sbin/dbus-daemon --system
4417 admin 420 S /usr/sbin/bluetoothd
4426 admin 256 S /usr/sbin/agent --adapter hci0
4618 admin 856 S /usr/sbin/cupsd -C /etc/config/cups/cupsd.conf
4841 admin 864 S /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/con
4852 admin 508 S /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/con
4892 guest 1472 S proftpd: (accepting connections)
4948 admin 4268 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
4967 admin SW [flush-9:9]
4973 admin 304 S /usr/sbin/ntpdated
5117 admin 468 S /usr/sbin/upsutil
5230 admin 540 S /usr/sbin/crond -l 9 -c /tmp/cron/crontabs
5518 admin 1460 S /usr/local/apache/bin/apache-dav -k start -f /etc/apa
5563 httpdusr 5720 S /usr/local/apache/bin/apache -k start -c PidFile /var
5564 httpdusr 6992 S /usr/local/apache/bin/apache -k start -c PidFile /var
5565 httpdusr 5316 S /usr/local/apache/bin/apache -k start -c PidFile /var
6539 admin 440 S /usr/bin/lunportman
6573 admin 688 S /sbin/bcclient
6592 admin 2092 S /usr/local/apache/bin/apache-dav -k start -f /etc/apa
6631 admin 13556 S /usr/local/apache/bin/apache -k start -c PidFile /var
6650 admin 5940 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
6676 admin 1124 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6677 admin 1124 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6678 admin 1148 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6679 admin 604 S /sbin/picd
6680 admin 596 S /sbin/gpiod
6681 admin 1140 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6682 admin 1128 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6689 guest 948 S avahi-daemon: running [VICNAS2.local]
6694 admin 716 S /sbin/hwmond
6768 admin 804 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
6771 admin 532 S N /usr/bin/rsyncd --daemon --sever-mode=1 --qnap-bwlimi
6870 admin 532 S /sbin/gen_bandwidth -r -i 5
6872 admin 712 S /sbin/hd_util
7042 admin 476 S /bin/sh /etc/init.d/klogd.sh start
7053 admin 336 S qNoticeEngined: Write notice is enabled...
7056 admin 360 S /sbin/qsyslogd
7064 admin 460 S qLogEngined: Write log is disabled...
7068 admin 392 S /sbin/qShield
7142 admin 312 S /bin/dd if=/proc/kmsg of=/mnt/HDA_ROOT/.logs/kmsg bs=
7170 admin SW< [iscsi_eh]
7216 admin SW [qnap_et]
7254 admin 404 S /sbin/iscsid --config=/etc/config/iscsi/sbin/iscsid.c
7259 admin 2248 S < /sbin/iscsid --config=/etc/config/iscsi/sbin/iscsid.c
7304 admin 424 S /sbin/vdd_control -d
7322 httpdusr 5312 S /usr/local/apache/bin/apache -k start -c PidFile /var
7693 admin 648 S /sbin/qbox_man -b
7728 admin 560 S /sbin/qboxd -n 0 -b -d0
7768 admin 340 S /sbin/versiond
7772 admin 516 S /usr/local/bin/qbox_monitor -pid:7728 -reg:/share/hom
7779 admin 320 S /sbin/versiond
7903 admin 560 S /usr/local/sbin/cnid_metad -F /etc/afp.conf
7960 admin 1144 S /usr/local/sbin/afpd -F /etc/afp.conf -p /var/afpd3.p
8049 admin 508 S /sbin/daemon_mgr
8115 admin 532 S /usr/local/bin/porter -d 7
8137 admin 556 S /usr/bin/qsyncman
8703 admin 2696 S /usr/sbin/dsd -level error -log /share/MD0_DATA/.qpkg
8961 admin 584 S /sbin/upnpcd -i 300
9079 admin 396 S /sbin/getty 115200 ttyS0
10367 admin 144 S N /sbin/dhcpcd -h VICNAS2 -t 30 eth0
11021 admin 912 S N /usr/local/samba/sbin/nmbd -l /var/log -D -s /etc/con
11302 admin 944 S /sbin/upnpd eth0 eth0
11358 admin 1156 S < /usr/local/apache/bin/apache_proxy -k start -f /etc/a
11524 admin 4556 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
11576 admin 956 S N /sbin/upnpd eth0 eth0
11746 admin 4504 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
12154 admin 1436 S /usr/local/sbin/_thttpd_ -p 58080 -nor -nos -u admin
12254 admin 4424 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
12716 admin 684 S /usr/sbin/sshd -f /etc/ssh/sshd_config -p 22
13736 admin SW [kworker/0:3]
15577 admin SW [kworker/0:0]
16713 admin 4512 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
17542 admin 4356 S /usr/local/apache/bin/apache_proxys -k start -f /etc/
17953 admin SW [kworker/0:2]
18588 admin 2464 S sshd: admin@pts/2
18595 admin 1316 S -sh
18601 admin SW [flush-9:13]
18641 admin Z [authLogin.cgi]
18649 admin 788 R ps -ef
23515 admin 776 S N /usr/bin/rsyncd --daemon --sever-mode=1 --qnap-bwlimi
23543 admin 556 R N /usr/bin/rsyncd --daemon --sever-mode=1 --qnap-bwlimi
30360 admin 536 S /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/u
30401 admin 2956 S /usr/local/mysql/libexec/mysqld --basedir=/usr/local/
32614 admin SW [kworker/0:1]
[QWEB]
Enable = 1
Port = 80
Enable_SSL = 1
SSL_Port = 443
Enable_WebDAV = 1
Enable_User_Permission = 1
LittleNo
Starting out
Posts: 12
Joined: Sat Dec 24, 2011 10:09 pm

Re: Webserver redirected to Admin Page

Post by LittleNo »

I just noticed a strange thing: I have ownCloud running on my NAS. I have a Domain set as virtual host, directed to the ownCloud-directory. When I access this domain (from outside of course) by a browser, I get redirected to the NAS-admin-page. With the same Domain as address in the ownCloud-iOS-App, the connection works as it should.

With this information it should be clear that the QNAP is redirecting the browsers https-traffic. Unfortunately I have no clue where this setting can be changed - or even better switched off. (If I want to access the NAS admin page I can manually open it by using the corresponding port)
Locked

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”