Reverse proxy

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post by presenceofmind »

it's been a month now. is this going to happen?
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post 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
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post 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.
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post 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
Last edited by presenceofmind on Thu Jul 20, 2017 7:29 am, edited 1 time in total.
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post by giopas »

Why don't you do what I did? What is the purpose of editing apache.conf?

Sent from my A0001 using Tapatalk
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post 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.
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post 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
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post by giopas »

Any news presenceofmind?
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post 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
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post 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
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post 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.
User avatar
ForSSkieken
Getting the hang of things
Posts: 61
Joined: Thu Sep 25, 2008 2:48 am
Location: Wijnegem

Re: Reverse proxy

Post 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
Last edited by ForSSkieken on Fri Jul 21, 2017 12:50 am, edited 1 time in total.
============================================================================================
TS-869L [RAID 5] Thick Provisioning 1 volume 6* 4TB


---------------------------------------------------------------------------------------------------------------------------------
TrueNAS on DELL R520
3 PC's in Workgroup
============================================================================================
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: RE: Re: Reverse proxy

Post 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
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
presenceofmind
Know my way around
Posts: 198
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Post by presenceofmind »

this has nothing to do with proxying.
First lets get the proxying working then we look at router forwarding.
Last edited by presenceofmind on Thu Jul 20, 2017 9:25 pm, edited 2 times in total.
giopas
Been there, done that
Posts: 855
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Post 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
Qnap TS-253Pro 16Gb RAM - Single Storage Pool: 2 WRed 4TB (RAID 1)
Qnap TS-453A 16Gb RAM - Single Storage Pool: 4 WRed 4TB (RAID 5)
Post Reply

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