Reverse proxy

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
presenceofmind
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Sun Jul 16, 2017 3:52 am

it's been a month now. is this going to happen?

giopas
Been there, done that
Posts: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Sun Jul 16, 2017 4:06 am

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Sun Jul 16, 2017 4:54 am

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
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Sun Jul 16, 2017 10:33 pm

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Sun Jul 16, 2017 11:00 pm

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
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Sun Jul 16, 2017 11:56 pm

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Mon Jul 17, 2017 12:08 am

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Mon Jul 17, 2017 11:51 pm

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
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Thu Jul 20, 2017 7:44 am

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Thu Jul 20, 2017 2:08 pm

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
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Thu Jul 20, 2017 4:55 pm

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: 55
Joined: Thu Sep 25, 2008 2:48 am
Location: Wijnegem

Re: Reverse proxy

Postby ForSSkieken » Thu Jul 20, 2017 6:11 pm

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 5 seagate ST3000DM001-1CH166

Running Firmware is Version 4.3.3 0229 build 20170624
---------------------------------------------------------------------------------------------------------------------------------
TS-509Pro [RAID 5] 3 Seagate ST2000DL003-9VT1CC32 2TB + WD20EARS-00J2GB080.0 2TB
3 PC's in Workgroup + 2 XBMC
============================================================================================

giopas
Been there, done that
Posts: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: RE: Re: Reverse proxy

Postby giopas » Thu Jul 20, 2017 6:34 pm

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
Starting out
Posts: 32
Joined: Thu May 26, 2016 3:05 pm

Re: Reverse proxy

Postby presenceofmind » Thu Jul 20, 2017 8:40 pm

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: 838
Joined: Thu Mar 26, 2015 12:36 am
Location: somewhere in EU

Re: Reverse proxy

Postby giopas » Thu Jul 20, 2017 8:51 pm

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)


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

Who is online

Users browsing this forum: No registered users and 4 guests