Virtual host not working

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Virtual host not working

Post by schumaku »

ste8604 wrote:if i want: qnap console on port 443 (https) and webserver on 443 (https) is possibile with virtual host??
No, sorry. Pitty, QNAP does still use a crappy old thttpd for the administration instead of using Apache ... there this would become feasible.
azaroth01
Starting out
Posts: 17
Joined: Tue Aug 13, 2019 5:38 pm

Re: Virtual host not working

Post by azaroth01 »

This is a rather old thread, yet I seem to be unable to resolve the underlying issue and would appreciate some help to find how to get the virtual host show my websites instead of the index.php in /Web.

Setup:

I have two sites using WordPress, one in the default location /share/CE_CACHEDEV1_DATA/Web/WordPress and the other one in a subdirectory of /share/CE_CACHEDEV1_DATA/Web/wp-tmd/wordpress.

The virtual host is running with ports 8082 and 8083 pointing to these directories, each one having their respective index.php at the ready.

When connecting from the web, the result is always showing the /share/CE_CACHEDEV1_DATA/Web/index.php content (which I have edited to show the same lovely picture as schumaku has kindly mentioned, in order to avoid the recurring redirect to the QNAP admin access screen.

What am I doing wrong?
azaroth01
Starting out
Posts: 17
Joined: Tue Aug 13, 2019 5:38 pm

Re: Virtual host not working

Post by azaroth01 »

Just adding some info for better understanding. This is the content of my httpd-ssl-vhosts-user.conf, that my QNAP generated:

NameVirtualHost *:8082

Listen 8082

<VirtualHost *:8082>
<Directory "/share/Web/WordPress">
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerName REDACTED.ch
DocumentRoot "/share/Web/WordPress"
SSLEngine on
SSLCipherSuite EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:!MD5
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile "/etc/stunnel/stunnel.pem"
</VirtualHost>
A curl to port 8082 results in:
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
a curl -v https://REDACTED.ch:8081 results in
* Rebuilt URL to: https://REDACTED.ch:8081/
* Trying 37.24.108.230...
* TCP_NODELAY set
* Connected to REDACTED.ch (xx.xx.xx.xx) port 8081 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=REDACTED.ch
* start date: Aug 12 21:06:00 2019 GMT
* expire date: Nov 10 21:06:00 2019 GMT
* subjectAltName: host "REDACTED.ch" matched cert's "REDACTED.ch"
* issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x562a4f74fda0)
> GET / HTTP/1.1
> Host: rothpartners.ch:8081
> User-Agent: curl/7.52.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< date: Tue, 13 Aug 2019 11:29:58 GMT
< server: Apache
< x-frame-options: SAMEORIGIN
< vary: Accept-Encoding
< content-type: text/html; charset=UTF-8
<
* Curl_http_done: called premature == 0
* Connection #0 to host REDACTED.ch left intact
<img src="http://i40.tinypic.com/avqurc.gif" border=0>

I was expecting the wordpress site to come up, but instead the /Web/index.php was called.
User avatar
dolbyman
Guru
Posts: 35024
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: Virtual host not working

Post by dolbyman »

please open a new thread...procedures used 7 (!!) years ago will probably not work anymore

..say NO to necroposting !
azaroth01
Starting out
Posts: 17
Joined: Tue Aug 13, 2019 5:38 pm

Re: Virtual host not working

Post by azaroth01 »

As there seems to be a constant stream of people asking the very same question (with different setups or issues, but similarities: multihost environments ending up calling /Web/index.php instead of the correct path), maybe you do have an idea on how to resolve it?

I followed your advice and put the same question to a recent thread o the same issue. The age of this thread, though, shows it's a recurring issue, yet I haven't been able to find an answer on what is causing it after doing a thorough search on different media.

Your kind support is highly appreciated.
User avatar
Toxic17
Ask me anything
Posts: 6469
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: Virtual host not working

Post by Toxic17 »

already answered in another post.

this isnt actually a QNAP issue, just a webserver issue, it could be on any platform. users must learn to know how to configure web server settings by learning something about Apache/PHP and what can be done with it.

the .htaccess file is one of the main files you will use to get your webserver working correctly.

Thread closed.
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
Locked

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