Page 2 of 3

Re: Reverse proxy

Posted: Sun Jul 16, 2017 3:52 am
by presenceofmind
it's been a month now. is this going to happen?

Re: Reverse proxy

Posted: Sun Jul 16, 2017 4:06 am
by giopas
I'll try to install gogs on my NAS and check. Unfortunately I am very busy and I have no time to 'play' with my NAS.

Sent from my A0001 using Tapatalk

Re: Reverse proxy

Posted: Sun Jul 16, 2017 4:54 am
by giopas
I have just tried and it works fine.

Here is what I did:

1. I have created on my domain provider a subdomain "gogs"
2. I have installed Qgit and then Gogs qpkg
3. I have opened an ssh connection and I have modified the config file of virtualhosts:

Code: Select all

[~] # vi /etc/config/apache/extra/httpd-vhosts-user.conf

Code: Select all

## gogs
<VirtualHost *:80>
        ServerName gogs.xxxxxx.com
        ProxyRequests Off
<Proxy *>
        #Order deny,allow
        Require all granted
</Proxy>
<Location />
        #Order allow,deny
        Require all granted
</Location>
        ProxyPreserveHost On
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/
        ProxyStatus On
</VirtualHost>
4. I have restarted apache:

Code: Select all

[~] # /etc/init.d/Qthttpd.sh restart
5. If I go to http://gogs.xxxxxx.com I reach the configuration page of Gogs as I did not do it before.

Nothing more.

Re: Reverse proxy

Posted: Sun Jul 16, 2017 10:33 pm
by presenceofmind
I gave it another try but the same problem persists (I would like to lightlight that what you've done is not what I'm trying to do).

1) Create file /etc/config/apache/extra/apache-proxy.conf:

Code: Select all

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
2) Add at the end of file /etc/config/apache/apache.conf:

Code: Select all

Include /etc/config/apache/extra/apache-proxy.conf
3) Restart web service:

Code: Select all

/etc/init.d/Qthttpd.sh restart
* Shutting down Qthttpd services: OK
* Starting Qthttpd services: OK

4) Go to control panel>web server on qnap UI and enable VirtualHost.

5) Add at the end of file /etc/config/apache/extra/httpd-vhosts-user.conf:

Code: Select all

<VirtualHost *:80>
	ServerName 
	DocumentRoot ""
	<Proxy *>
		Order allow,deny
		Require all granted
	</Proxy>
	<Location "/git">
		Order allow,deny
		Allow from all
		ProxyPreserveHost On
		ProxyPass / /http://localhost:3000/
		ProxyPassReverse / http://localhost:3000/
		ProxyStatus On
	</Location>
</VirtualHost>
6) Restart web service:

Code: Select all

/etc/init.d/Qthttpd.sh restart
* Shutting down Qthttpd services: OK
* Recover apache confiugre <--------- This is resetting the apache.conf, removing proxy modules, my issue from the start
* Starting Qthttpd services: OK

Re: Reverse proxy

Posted: Sun Jul 16, 2017 11:00 pm
by giopas
Why don't you do what I did? What is the purpose of editing apache.conf?

Sent from my A0001 using Tapatalk

Re: Reverse proxy

Posted: Sun Jul 16, 2017 11:56 pm
by presenceofmind
It's my undestanding that qnap web server doesn't have the proxy modules installed. You have to include them manually.
Proxy commands shouldn't work without it. It's in your second post.

Re: Reverse proxy

Posted: Mon Jul 17, 2017 12:08 am
by giopas
I wrote that post some time ago. Try without any further change and report please. Otherwise I will check again on my system what I might have done

Sent from my A0001 using Tapatalk

Re: Reverse proxy

Posted: Mon Jul 17, 2017 11:51 pm
by giopas
Any news presenceofmind?

Re: Reverse proxy

Posted: Thu Jul 20, 2017 7:44 am
by presenceofmind
unfortunately no luck.
I 've tried your steps 1 by 1.
Then I had a few other tries with two changes:
1) fix what looks an issue with the xml Location tag in your config file.
2) change from a subdomain (http://gogs.xxxxxx.com/) into a different port (http://192.168.1.1:100).
No success.
and still getting * Recover apache confiugre

Re: Reverse proxy

Posted: Thu Jul 20, 2017 2:08 pm
by giopas
Are you sure: 1. Virtual host is activated on QTS settings, 2. DNS are correctly resolved, 3. What is the Location error?, 4. Can you access gogl simply using ip:port from within your LAN?, 5. Have you forwarded port 80 on your router?, 6. What is the *recover apache configure*?

Sent from my A0001 using Tapatalk

Re: Reverse proxy

Posted: Thu Jul 20, 2017 4:55 pm
by presenceofmind
Are you sure:
1. Virtual host is activated on QTS settings, - Yes, it's one of the steps in my previous post item 4.
2. DNS are correctly resolved, what exactly you want to know. I use qnap cloud domain to access from the internet and it works fine.
3. What is the Location error?, - nevermind. I see what you've done there.
4. Can you access gogl simply using ip:port from within your LAN?, - using port 3000 yes I can.
5. Have you forwarded port 80 on your router?, Yes I have. I can access qnap on the internet using my qnap cloud domain(xxx.myqnapcloud.com)
6. What is the *recover apache configure*? - This is part of the issue since the begging. web server resets the config files during the restart.

Re: Reverse proxy

Posted: Thu Jul 20, 2017 6:11 pm
by ForSSkieken
Hi There,

I don't know if my problem is similar, but I Think so.

I have enabled the webserver in the GUI
I have enabeld virtual host /Web/webtrees 8081
I have a WAN,Lan "Webtrees" website
LAN http://192.168.1.5/webtrees/index.php?c ... d=Forssman working
WAN https://xxx.xxx.xxx.138:80/webtrees/ind ... d=Forssman working

The problem is that I would like to give another familymember acces to this genealogy site he has to type the :80 port

Without the :80 port I get following error
Hmm, we can’t reach this page.
Try this
Make sure that you’ve got the right web address: https://xxx.xxx.xxx.138
Then there's the HTTPS not secure problem. How do I make sure that with a openssl certificate this doesn't happen anymore.

Thanks for reading
Guy

Re: RE: Re: Reverse proxy

Posted: Thu Jul 20, 2017 6:34 pm
by giopas
presenceofmind wrote:Are you sure:
1. Virtual host is activated on QTS settings, - Yes, it's one of the steps in my previous post item 4.
2. DNS are correctly resolved, what exactly you want to know. I use qnap cloud domain to access from the internet and it works fine.
3. What is the Location error?, - nevermind. I see what you've done there.
4. Can you access gogl simply using ip:port from within your LAN?, - using port 3000 yes I can.
5. Have you forwarded port 80 on your router?, Yes I have. I can access qnap on the internet using my qnap cloud domain(xxx.myqnapcloud.com)
6. What is the *recover apache configure*? - This is part of the issue since the begging. web server resets the config files during the restart.
I think you also need to manually forward port 80 on your router. Qts is actually by default open via upnp on port 8080 if I am not wrong...

Sent from my A0001 using Tapatalk

Re: Reverse proxy

Posted: Thu Jul 20, 2017 8:40 pm
by presenceofmind
this has nothing to do with proxying.
First lets get the proxying working then we look at router forwarding.

Re: Reverse proxy

Posted: Thu Jul 20, 2017 8:51 pm
by giopas
If the app works in the LAN, but the reverse proxy does not and virtual host is well set up, the problem can only be on port forwarding.

Can you post the exact (just with xxx instead of your QID name) section on Virtual Host?

Sent from my A0001 using Tapatalk