Server refused connection for websites on virtual hosting

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
homenas
New here
Posts: 5
Joined: Tue May 17, 2011 12:18 pm

Server refused connection for websites on virtual hosting

Post by homenas »

Hi

I had websites running on my QNAP with virtual hosting. I was just starting and redid everything to have a clean start agian.
Now I have 2 virtual host defined, but get an error: server refused connection.

When I stop virtual hosting and upload wordpress under /web/ then I am redirected to the administration page of qnap.

I tried everything. Reset web service, reset PHP, delete web directory again, but nothing works.
Which analysis tools exist to find out what is wrong?

Thanks for your help,
Stafylocok
New here
Posts: 4
Joined: Thu Feb 09, 2017 6:18 pm

Re: Server refused connection for websites on virtual hosting

Post by Stafylocok »

Wow I'm so glad I found your post.
I'm experiencing exactly the same thing here.

I got in touch with the french support, we're trying to find a solution, which we haven't yet.


Please keep in touch if you find a solution from your side, I will as well.



I started from scratch so here is what I did :
Set my server on DHCP constant IP both on my router and on the Qnap
Re-directed port 80 and port 8081 on my router

Enabled the SQL server
Installed phpmyadmin
Created a database on phpmyadmin

Enabled web server
Made sure that ports were set up to 80 and 8081 for secure connection

Installed WordPress
Linked WordPress to my database on phpMyadmin

on my domain provider, I redirected my domain to my IP address.


At this point, everything should actually be "brand new". What I actually got is a redirect to my admin qnap page when I'm searching for both http://mydomain.com and httpS://mydomain.com

When trying to delete index.php I get a forbidden error on httpS://... and the servers tries to redirect to the admin page on http:// but takes too much time to respond.


I've started from scratch at least 8 to 10 times, nothing is working and I can't figure out what I'm doing wrong.
homenas
New here
Posts: 5
Joined: Tue May 17, 2011 12:18 pm

Re: Server refused connection for websites on virtual hosting

Post by homenas »

Dear all,

I found a solution.
There were two errors.

First step:

[~] # /etc/init.d/Qthttpd.sh stop
...
[~] # cp /etc/default_config/apache.conf /etc/config/apache/apache.conf
[~] # /etc/init.d/Qthttpd.sh start
...

This is from another thread.

Then I saw that the subdirectories are not copied to the /web/.../ directories
Now it is working.

Regards,

Arthur
Stafylocok
New here
Posts: 4
Joined: Thu Feb 09, 2017 6:18 pm

Re: Server refused connection for websites on virtual hosting

Post by Stafylocok »

Hello Arthur,

Could you please add some lines about this? I am afraid I don't understand the way to fix the error with what you wrote.

Where did you write this?


I don't understand the error therefore I don't understand your solution :/

Staf
loujacob66
Starting out
Posts: 11
Joined: Mon Jun 17, 2013 11:51 pm

Re: Server refused connection for websites on virtual hosting

Post by loujacob66 »

I'm getting the same errors. Files are where they are supposed to be however, it seems that the contents of httpd-vhosts-user.conf are almost entirely ignored. I've checked to ensure that the file is included in the main httpd.conf files, and I've done some hand editing to test that different ports are listened to, etc, but for some reason, only the main host works, but none of the virtual ones.

Here are the contents of my config file; very simple:

NameVirtualHost *:80


<VirtualHost _default_:80>
DocumentRoot "/share/Web"
</VirtualHost>
<VirtualHost *:80>
<Directory "/share/Web">
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerName www.xyz.dev
DocumentRoot "/share/Web/xyz"
</VirtualHost>
bl4d3
Starting out
Posts: 26
Joined: Fri Oct 05, 2012 3:03 am

Re: Server refused connection for websites on virtual hosting

Post by bl4d3 »

Stafylocok, use PuTTY to connect over SSH wit your station. You can read this file homenas mentioned "etc/default_config/apache.conf". The start and stop command is for the apache service.

Just copied the contents of each file here for everyone:

"etc/default_config/apache.conf"

Code: Select all

#ServerType standalone
ServerRoot "/usr/local/apache"
Mutex file:/var/lock/ default
PidFile /var/lock/apache.pid
#ScoreBoardFile /usr/local/apache/logs/apache.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ServerLimit 4
StartServers 2
MaxClients 256
MinSpareThreads 32
MaxSpareThreads 120
ThreadsPerChild 64
MaxRequestsPerChild 1000
Listen 80
User admin
Group administrators
ServerAdmin admin@NAS
#ServerName NAS
TraceEnable off
ServerTokens Prod
DocumentRoot "/share/Qweb"
<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied
</Directory>
<Directory "/share/Qweb">
	Options FollowSymLinks MultiViews
	AllowOverride All
	Require all granted
</Directory>
Include /etc/config/apache/extra/apache-default-modules.conf
<IfModule headers_module>
	Header always append X-Frame-Options SAMEORIGIN "env=!share-iframe"
	Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
<IfModule dir_module>
		DirectoryIndex index.html index.htm index.php
</IfModule>

AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied
    Satisfy All
</FilesMatch>

UseCanonicalName Off
HostnameLookups Off

<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

ErrorLog logs/error_log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel crit

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
		LogFormat "%{Referer}i -> %U" referer
		LogFormat "%{User-agent}i" agent

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
#CustomLog logs/access_log common
    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog logs/access_log combined
</IfModule>


#
# Aliases: Add here as many aliases as you need (with no limit). The format is 
# Alias fakename realname
#

<IfModule alias_module>
		Alias /v3_menu/ "/home/httpd/v3_menu/"
		<Directory "/home/httpd/v3_menu">
				AllowOverride None
				Require all granted
		</Directory>
</IfModule>

<IfModule autoindex_module>
		AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

		AddIconByType (TXT,/icons/text.gif) text/*
		AddIconByType (IMG,/icons/image2.gif) image/*
		AddIconByType (SND,/icons/sound2.gif) audio/*
		AddIconByType (VID,/icons/movie.gif) video/*

		AddIcon /icons/binary.gif .bin .exe
		AddIcon /icons/binhex.gif .hqx
		AddIcon /icons/tar.gif .tar
		AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
		AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
		AddIcon /icons/a.gif .ps .ai .eps
		AddIcon /icons/layout.gif .html .shtml .htm .pdf
		AddIcon /icons/text.gif .txt
		AddIcon /icons/c.gif .c
		AddIcon /icons/p.gif .pl .py
		AddIcon /icons/f.gif .for
		AddIcon /icons/dvi.gif .dvi
		AddIcon /icons/uuencoded.gif .uu
		AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
		AddIcon /icons/tex.gif .tex
		AddIcon /icons/bomb.gif core

		AddIcon /icons/back.gif ..
		AddIcon /icons/hand.right.gif README
		AddIcon /icons/folder.gif ^^DIRECTORY^^
		AddIcon /icons/blank.gif ^^BLANKICON^^
		DefaultIcon /icons/unknown.gif

		ReadmeName README.html
		HeaderName HEADER.html

		IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>

#
# Document types.
#
<IfModule mime_module>
		TypesConfig /etc/config/apache/mime.types
		AddLanguage da .dk
		AddLanguage nl .nl
		AddLanguage en .en
		AddLanguage et .ee
		AddLanguage fr .fr
		AddLanguage de .de
		AddLanguage el .el
		AddLanguage he .he
		AddCharset ISO-8859-8 .iso8859-8
		AddLanguage it .it
		AddLanguage ja .ja
		AddCharset ISO-2022-JP .jis
		AddLanguage kr .kr
		AddCharset ISO-2022-KR .iso-kr
		AddLanguage nn .nn
		AddLanguage no .no
		AddLanguage pl .po
		AddCharset ISO-8859-2 .iso-pl
		AddLanguage pt .pt
		AddLanguage pt-br .pt-br
		AddLanguage ltz .lu
		AddLanguage ca .ca
		AddLanguage es .es
		AddLanguage sv .sv
		AddLanguage cs .cz .cs
		AddLanguage ru .ru
		AddLanguage zh-TW .zh-tw
		AddCharset Big5				 .Big5		.big5
		AddCharset WINDOWS-1251 .cp-1251
		AddCharset CP866				.cp866
		AddCharset ISO-8859-5   .iso-ru
		AddCharset KOI8-R		   .koi8-r
		AddCharset UCS-2				.ucs2
		AddCharset UCS-4				.ucs4
		AddCharset UTF-8				.utf8
		<IfModule negotiation_module>
				LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
		</IfModule>
		AddType application/x-tar .tgz
		AddEncoding x-compress .Z
		AddEncoding x-gzip .gz .tgz
		AddType application/x-compress .Z
		AddType application/x-gzip .gz .tgz
		AddType application/x-httpd-php .php .php4 .php3 .phtml
		AddType application/x-httpd-php-source .phps
		AddHandler cgi-script .cgi
		AddType text/html .shtml
		AddHandler server-parsed .shtml
		AddHandler send-as-is asis
		AddHandler imap-file map
		AddHandler type-map var
</IfModule>

<IfModule mime_magic_module>
		MIMEMagicFile /etc/config/apache/magic
</IfModule>

<IfModule setenvif_module>
		BrowserMatch "Mozilla/2" nokeepalive
		BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
		BrowserMatch "RealPlayer 4\.0" force-response-1.0
		BrowserMatch "Java/1\.0" force-response-1.0
		BrowserMatch "JDK/1\.0" force-response-1.0
</IfModule>

<IfModule ssl_module>
	SSLRandomSeed startup builtin
	SSLRandomSeed connect builtin
</IfModule>

<IfModule reqtimeout_module>
	RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
</IfModule>
Include /etc/config/apache/extra/apache-fastcgi.conf
(My current) "/etc/config/apache/apache.conf"

Code: Select all

#ServerType standalone
ServerRoot "/usr/local/apache"
Mutex file:/var/lock/ default
PidFile /var/lock/apache.pid
#ScoreBoardFile /usr/local/apache/logs/apache.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ServerLimit 4
StartServers 3
MaxClients 256
MinSpareThreads 32
MaxSpareThreads 120
ThreadsPerChild 64
MaxRequestsPerChild 1000
Listen 80
User httpdusr
Group administrators
ServerAdmin admin@NAS
#ServerName NAS
TraceEnable off
ServerTokens Prod
DocumentRoot "/share/Web"
<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied
</Directory>
<Directory "/share/Web">
	Options FollowSymLinks MultiViews
	AllowOverride All
	Require all granted
</Directory>
Include /etc/config/apache/extra/apache-default-modules.conf
<IfModule headers_module>
	Header unset X-Frame-Options
	Header always edit Set-Cookie ^(.*)$ $1;HttpOnly
</IfModule>
<IfModule dir_module>
		DirectoryIndex index.html index.htm index.php
</IfModule>
AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied
    Satisfy All
</FilesMatch>
UseCanonicalName Off
HostnameLookups Off
<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
ErrorLog /dev/null
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel crit
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
		LogFormat "%{Referer}i -> %U" referer
		LogFormat "%{User-agent}i" agent
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
</IfModule>
#
# Aliases: Add here as many aliases as you need (with no limit). The format is 
# Alias fakename realname
#
<IfModule alias_module>
		Alias /v3_menu/ "/home/httpd/v3_menu/"
		<Directory "/home/httpd/v3_menu">
				AllowOverride None
				Require all granted
		</Directory>
</IfModule>
<IfModule autoindex_module>
		AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
		AddIconByType (TXT,/icons/text.gif) text/*
		AddIconByType (IMG,/icons/image2.gif) image/*
		AddIconByType (SND,/icons/sound2.gif) audio/*
		AddIconByType (VID,/icons/movie.gif) video/*
		AddIcon /icons/binary.gif .bin .exe
		AddIcon /icons/binhex.gif .hqx
		AddIcon /icons/tar.gif .tar
		AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
		AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
		AddIcon /icons/a.gif .ps .ai .eps
		AddIcon /icons/layout.gif .html .shtml .htm .pdf
		AddIcon /icons/text.gif .txt
		AddIcon /icons/c.gif .c
		AddIcon /icons/p.gif .pl .py
		AddIcon /icons/f.gif .for
		AddIcon /icons/dvi.gif .dvi
		AddIcon /icons/uuencoded.gif .uu
		AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
		AddIcon /icons/tex.gif .tex
		AddIcon /icons/bomb.gif core
		AddIcon /icons/back.gif ..
		AddIcon /icons/hand.right.gif README
		AddIcon /icons/folder.gif ^^DIRECTORY^^
		AddIcon /icons/blank.gif ^^BLANKICON^^
		DefaultIcon /icons/unknown.gif
		ReadmeName README.html
		HeaderName HEADER.html
		IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>
#
# Document types.
#
<IfModule mime_module>
		TypesConfig /etc/config/apache/mime.types
		AddLanguage da .dk
		AddLanguage nl .nl
		AddLanguage en .en
		AddLanguage et .ee
		AddLanguage fr .fr
		AddLanguage de .de
		AddLanguage el .el
		AddLanguage he .he
		AddCharset ISO-8859-8 .iso8859-8
		AddLanguage it .it
		AddLanguage ja .ja
		AddCharset ISO-2022-JP .jis
		AddLanguage kr .kr
		AddCharset ISO-2022-KR .iso-kr
		AddLanguage nn .nn
		AddLanguage no .no
		AddLanguage pl .po
		AddCharset ISO-8859-2 .iso-pl
		AddLanguage pt .pt
		AddLanguage pt-br .pt-br
		AddLanguage ltz .lu
		AddLanguage ca .ca
		AddLanguage es .es
		AddLanguage sv .sv
		AddLanguage cs .cz .cs
		AddLanguage ru .ru
		AddLanguage zh-TW .zh-tw
		AddCharset Big5				 .Big5		.big5
		AddCharset WINDOWS-1251 .cp-1251
		AddCharset CP866				.cp866
		AddCharset ISO-8859-5   .iso-ru
		AddCharset KOI8-R		   .koi8-r
		AddCharset UCS-2				.ucs2
		AddCharset UCS-4				.ucs4
		AddCharset UTF-8				.utf8
		<IfModule negotiation_module>
				LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
		</IfModule>
		AddType application/x-tar .tgz
		AddEncoding x-compress .Z
		AddEncoding x-gzip .gz .tgz
		AddType application/x-compress .Z
		AddType application/x-gzip .gz .tgz
		AddType application/x-httpd-php .php .php4 .php3 .phtml
		AddType application/x-httpd-php-source .phps
		AddHandler cgi-script .cgi
		AddType text/html .shtml
		AddHandler server-parsed .shtml
		AddHandler send-as-is asis
		AddHandler imap-file map
		AddHandler type-map var
</IfModule>
<IfModule mime_magic_module>
		MIMEMagicFile /etc/config/apache/magic
</IfModule>
<IfModule setenvif_module>
		BrowserMatch "Mozilla/2" nokeepalive
		BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
		BrowserMatch "RealPlayer 4\.0" force-response-1.0
		BrowserMatch "Java/1\.0" force-response-1.0
		BrowserMatch "JDK/1\.0" force-response-1.0
</IfModule>
<IfModule ssl_module>
	SSLRandomSeed startup builtin
	SSLRandomSeed connect builtin
</IfModule>
<IfModule reqtimeout_module>
	RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
</IfModule>
Include /etc/config/apache/extra/apache-force-ssl.conf
Include /etc/config/apache/extra/apache-ssl.conf
Include /etc/config/apache/extra/apache-fastcgi.conf
Include /etc/config/apache/extra/apache-video.conf
Include /etc/config/apache/extra/apache-http-compress.conf
Include /etc/config/apache/extra/apache-musicstation.conf
Include /etc/config/apache/extra/apache-photo.conf
There are differences between both fies, but I can't explain, how and why should this happen.
bl4d3
Starting out
Posts: 26
Joined: Fri Oct 05, 2012 3:03 am

Re: Server refused connection for websites on virtual hosting

Post by bl4d3 »

I followed the first steps mentioned by homenas, but starting the internal Apache web server just broguht me the version of my apache.conf back, which differs to the one from "default_config" folder. So is this useless?

I'm not sure what homenas meant by fixing the second error, because he had seen that there are no subfolders copied. Not sure what does this mean.
User avatar
jaysona
Been there, done that
Posts: 854
Joined: Tue Dec 02, 2008 11:26 am
Location: Somewhere in the Great White North

Re: Server refused connection for websites on virtual hosting

Post by jaysona »

bl4d3 wrote: Fri Jul 31, 2020 8:29 am Stafylocok, use PuTTY to connect over SSH wit your station. You can read this file homenas mentioned "etc/default_config/apache.conf". The start and stop command is for the apache service.

....
I'm fairly certain that after 17 months, the OP has sorted out their issue - or does not really care anymore about the post that is nearly one and a half years old.......
RAID is not a Back-up!

H/W: QNAP TVS-871 (i7-4790. 16GB) (Plex server) / TVS-EC1080 (32Gig ECC) - VM host & seedbox
H/W: Asustor AS6604T (8GB) / Asustor AS7010T (16GB) (media storage)
H/W: TS-219 Pro / TS-509 Pro
O/S: Slackware 14.2 / MS Windows 7-64 (x5)
Router1: Asus RT-AC86U - Asuswrt-Merlin - 386.7_2
Router2: Asus RT-AC68U - Asuswrt-Merlin - 386.7_2
Router3: Linksys WRT1900AC - DD-WRT v3.0-r46816 std
Router4: Asus RT-AC66U - FreshTomato v2021.10.15

Misc: Popcorn Hour A-110/WN-100, Pinnacle Show Center 250HD, Roku SoundBridge Radio (all retired)
Ditched QNAP units: TS-269 Pro / TS-253 Pro (8GB) / TS-509 Pro / TS-569 Pro / TS-853 Pro (8GB)
TS-670 Pro x2 (i7-3770s 16GB) / TS-870 Pro (i7-3770 16GB) / TVS-871 (i7-4790s 16GB)
bl4d3
Starting out
Posts: 26
Joined: Fri Oct 05, 2012 3:03 am

Re: Server refused connection for websites on virtual hosting

Post by bl4d3 »

jaysona, you could be right, but this issue is yet not closed and I' facing the same problem in 2020. There is no complete solution provided, questions open and those who will search and find this topic might struggle to understand what they're talking about. I brought light into this topic. My concern is not to warm up leftovers, rather help to find a solution.
Post Reply

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