Join the community today
Register Now

Nginx How to run a location from different nginx server ?

Discussion in 'Nginx and PHP-FPM news & discussions' started by negative, Mar 3, 2016.

Tags:
  1. negative

    negative Member

    217
    22
    18
    Apr 11, 2015
    Ratings:
    +50
    Local Time:
    1:37 PM
    1.9.10
    10.1.11
    Hello everyone!
    I want to run a "location" from another web server in nginx.

    I would like explain that with example:
    10.0.0.1 and 10.0.0.2 both webserver ( they have centmin mod nginx php etc. everything are same)

    Normally, i publish my website (portal + forum) from 10.0.0.1
    My forum directory is /forum/ in homedir. (it is not subdomain, it is subfolder)

    I want to run only /forum/ location from 10.0.0.2 (my another webserver). I think it maybe with proxy_pass or fastcgi pass i dont now exactly.

    I have tried some parameters like "proxy_pass" but i didn't it

    How can i do that ?

    Thanks.
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,850
    6,904
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,394
    Local Time:
    9:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    For nginx reverse proxy read the documentation, tutorial and guides below
    Of course, that's why i have forums and blogs on subdomains, so can use separate servers without needing a reverse proxy :)
     
  3. negative

    negative Member

    217
    22
    18
    Apr 11, 2015
    Ratings:
    +50
    Local Time:
    1:37 PM
    1.9.10
    10.1.11
    Hello, please don't get me wrong! I don't want to take free support from you already. I write here because someone may help me about this process.

    I'm sorry that because i'm not using subdomain :) But i think, there is a way for run a subfolder from different server too.

    Thank you anyway @eva2000
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,850
    6,904
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,394
    Local Time:
    9:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    no probs, just general statement as other folks may come across this thread in future :)

    but my links above have all you need :D
     
  5. negative

    negative Member

    217
    22
    18
    Apr 11, 2015
    Ratings:
    +50
    Local Time:
    1:37 PM
    1.9.10
    10.1.11
    Yes but i can't do it :) Because, for example when i tried that

    Code:
    location /forum {
        proxy_pass http://10.0.0.2;
    }
    Then, forum directory can't open also 404 because 10.0.0.2 default page is not my nginx domains public directory. It is default "Centmin Mod Nginx Test Page"

    So i think, i should do that call my website from ip address too. Am i right ?

    P.S: Need that small help from you :D
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,850
    6,904
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,394
    Local Time:
    9:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Answers are all in the linked documentation I posted is all I'd say ;)