Welcome to Centmin Mod Community
Become a Member

Nginx Reversed proxy help requied

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by danielsl, Nov 14, 2014.

  1. danielsl

    danielsl New Member

    20
    2
    3
    Nov 7, 2014
    Ratings:
    +3
    Local Time:
    3:15 PM
    centminmod 123.09beta01
    5.5
    QuestionS
    Cant recreate the environment I used to work back to apache

    under ZpanelCP I had
    Jetty - Servlet Engine and Http Server - Eclipse

    installed to /opt/jetty chowned to jetty user

    it served servlets to webserver_IP:8085/war
    So i had proxy tuned in way so requests
    to my_ip:80 ->actually passed to jetty server_> and then it returned content to apache

    so it was a reverse proxy i.m trying unsuccessful try_start on nginx

    With reversedproxy

    Working example.
    -->zpanel vitualovveride

    ServerName f.0dan.ru
    ServerAlias www.f.0dan.ru
    ProxyRequests off
    ProxyPreserveHost On

    ProxyPass / http://f.0dan.ru:8085/war/
    ProxyPassReverse / http://f.0dan.ru:8085/war/


    ------------------------
    What ever I do i can't get it work under nginx
    403 or 503 all i have
    If anyone could help..
    I saw here NOde.js guide with some proxing, but didn't get a thing
    mine config is
    location ^~/.* {
    proxy_pass http://f.0dan.ru:8080;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;}


    but it doesnt work
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,088
    7,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,198
    Local Time:
    10:15 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you said it works after you installed Java JDK ?
     
  3. danielsl

    danielsl New Member

    20
    2
    3
    Nov 7, 2014
    Ratings:
    +3
    Local Time:
    3:15 PM
    centminmod 123.09beta01
    5.5
    Yea JAVA JDK
    Jetty used to work fine, But proxy didn't as far I have no clear idea how proxying works under nginx and centminmod.

    Unfortunately last jetty install failed to serve servets, so i can't provide any working web site live now to show its response.
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,088
    7,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,198
    Local Time:
    10:15 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    well that could explain 503 errors where service is unavailable as Jetty isn't running then
     
  5. danielsl

    danielsl New Member

    20
    2
    3
    Nov 7, 2014
    Ratings:
    +3
    Local Time:
    3:15 PM
    centminmod 123.09beta01
    5.5
    ok almost fixed that all works, except few strokes

    Guide:-howto
    Java install on centos 6
    CentOS Install Java SDK using yum Command

    Jetty servlet http engine
    Eclipse Jetty 9.0 installation on Centos 6.3 | Notes From Kuku
    changes to install
    jetty 9.0 is replaced to 9.1. 0 m0
    http://archive.eclipse.org/jetty/9.1.0.M0/dist/

    9.2 did not compile
    useradd jetty
    [[email protected] opt]# chown -R jetty:jetty /opt/jetty
    does not start from jetty user- i skipped that and ran jetty from root
    no idea if its bad or not, need advice here

    cp jetty/bin/jetty.sh /etc/init.d/jetty
    replaced
    ln -s /opt/jetty/bin/jetty.sh /etc/init.d/jetty

    nginx_IP.conf per site

    server {
    listen 80;
    server_name your_IP;


    location / {
    proxy_pass http://127.0.0.1:8080/war/; #war in case you have servlets there
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    }
    }
    f.0dan.ru as an example runs a servlet gallery script serving google plus gallery

    NEED ADVICE & solutions

    0 Do i need to secure jetty somehow,
    could not run it from jetty user , it failed to start, so ROOT
    1 HOW to serve static files css.js by nginx directly from war/ with subdirectories
    2 is there any better node.js or php gallery using google plus, flickr and other photoshares
    3 anyone installed elasticsearch ELM stack on centminmod?
    4 can I serve remote(google plus) photos not by jetty but nginx?? with proxied http
     
  6. eva2000

    eva2000 Administrator Staff Member

    36,088
    7,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,198
    Local Time:
    10:15 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    1. can't help you with Jetty as never used it, but from google search landed me at TechDev Blog: Nginx + Jetty 7 + Multiple Contexts so maybe need to set the root /web root in Nginx vhost to where Jetty war/ is ?

    2. no idea with Jetty or node.js both technologies I don't work with or unfamiliar with enough

    3. Axivo repo has elasticsearch https://www.axivo.com/resources/elasticsearch-setup.11/. Axivo is include by default in Centmin Mod .08 beta if CentOS 6.5 is detected. CentOS 7 Axivo though doesn't have Elasticsearch so need to install it manually via official Elasticsearch RPMs at Elastic Search Install and Upgrade? | Centmin Mod Community For Centmin Mod .07 stable it was disabled by default see here for how to manually install Axivo repo post initial install.

    4. no idea with Jetty
     
..