Welcome! Log In Create A New Profile

Advanced

Re: Reverse proxy for multiple domains

Francis Daly
May 22, 2018 04:02PM
On Mon, May 21, 2018 at 01:57:07PM +0000, Mik J via nginx wrote:

Hi there,

> I would like to know what is the best practice to setup a web proxy.
>
> I do it like this
> - 1 virtual host per application on the reverse proxy and the proxy_pass points to one IP+path
> - 1 virtual host (default) for all application on the backend server but one location stanza per application
>
> The problem is that I meet many problems with installation of application: magento, glpi, etc

If the problem is *installing* the applications, that might be a
question for the application list. If the problem is *reverse-proxying*
the applications, that might be a question for the nginx list.

It is good to be clear about what the specific problem you are seeing is.

> Is it the correct way to do it ?

It is usually easiest if the front-end /prefix and the back-end /prefix
are identical.

So if the back-end application is happy being installed at /application1/,
then the front-end should reverse-proxy from frontend/application1/ to
upstream1/application1/. In that case, multiple applications could all be
on the same frontend server{}, or on different ones. If different ones,
then it can redirect from / to /application1/ if that is simplest.

If the back-end application insists on being installed at /, then the
front-end should reverse-proxy from frontend/ to upstream2/. In that case,
you will probably need multiple frontend server{}s; one for each similar
application.

> location ^~ / {
> proxy_pass        http://10.1.1.10:80/app/application1/;

"/" to "/app/application1/" is possible, but it is easy for things to
go wrong.

For example: if the application returns a link to
/app/application1/file, the next request to the upstream might be to
/app/application1/app/application1/file, which may not work as desired.

> server {
> listen 80 default_server;

This config looks generally right, if it is the correct way to install
this application...

> server_name _;
> index index.html index.htm index.php;
> root /var/www/htdocs;
> location ^~ /app/application1 {
> root /var/www;
> index index.php;
> location ~ \.php$ {

Note, though, that:

> root          /var/www;
> try_files $uri =404;

those two lines...

> fastcgi_pass  unix:/run/php-fpm.application1.sock;

> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_index  index.php;

and those two lines, probably do not do anything useful here.

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Reverse proxy for multiple domains

Mik J via nginx August 10, 2017 05:18PM

Re: Reverse proxy for multiple domains

Francis Daly August 17, 2017 03:46PM

Re: Reverse proxy for multiple domains

Mik J via nginx August 18, 2017 03:04AM

Re: Reverse proxy for multiple domains

Francis Daly August 20, 2017 04:10PM

Re: Reverse proxy for multiple domains

Mik J via nginx August 27, 2017 07:28AM

Re: Reverse proxy for multiple domains

Francis Daly August 30, 2017 01:58PM

Re: Reverse proxy for multiple domains

Mik J via nginx May 21, 2018 09:58AM

Re: Reverse proxy for multiple domains

Francis Daly May 22, 2018 04:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 212
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready