1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Nginx alongside apache in PLESK 9.3

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by Saif Bechan, Mar 10, 2010.

  1. Saif Bechan

    Saif Bechan Guest

    0
     
    Does anyone know how to set up Nginx alongside apache in PLESK 9.3. I want to serve my dynamic content from apache and the static content from Ningx.

    I read that there is a new configuration setting in plesk 9.3 where you can do that, but i can't find an explanation on how to do so.
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,564
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
  3. Saif Bechan

    Saif Bechan Guest

    0
     
    Hi yeah ive seen this also. It was the first place i checked, the documentation. But there is no discription on how to install nginx. Or is this already installed?

    I see how to chage the port tho. Thanks for pointing it out.
     
  4. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,564
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    There is nothing special. Just use vendor's package for nginx installation. Installation should be safe.
     
  5. lvalics

    lvalics Silver Pleskian Plesk Guru

    36
    43%
    Joined:
    Jun 20, 2003
    Messages:
    965
    Likes Received:
    32
    Location:
    Romania
  6. Saif Bechan

    Saif Bechan Guest

    0
     
    @lvalics

    Wow this is the type of tutorial i was looking for. It looks pretty good, it's the second good tutorial i've seen from you guys.

    I will try this out some day in the next few days, and then look to see if it all works out.

    Thanks!
     
  7. Saif Bechan

    Saif Bechan Guest

    0
     
    Getting some errors

    @lvalics

    I tried using the tutorial on your website to set this up:

    http://www.grafxsoftware.com/faq.php/HOW-TO-configure-PLESK-with-NGinx-proxy-reverse/1/1/

    When i try to test my configuration i get the following error:

    "proxy_rewrite_location default" must go after the "proxy_pass" directive in /etc/nginx/proxy.conf:1

    I tried to google it but a get a bunch of russian websites but did not find any solution. Does anyone know a solution to this.

    I tried to add the entry proxy_rewrite_location default; to the proxy.conf file but with no succes. I dont see any proxy_pass value either so i have no clue what they are talking about.

    Thanks in advance

    Edit 1

    I have managed to fix the problem i guess, i don't know if it is good. I have changed the following value.

    - proxy_redirect default;
    + proxy_redirect off;

    So i changed the value from default to off. Is this good or did i just turn off the whole thing.

    That said i did stumble upon another another issue. I got the following message after doing the test again:

    open() "/etc/nginx/webmail.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:55

    Now i google a bit and found the following code:

    server {
    listen 80;
    server_name webmail.* ;
    access_log /var/log/nginx/webmail/access.log;
    location / {
    proxy_pass http://mail1;
    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;
    proxy_redirect false;
    }
    }

    When i run this i stumbled uppon numerous erros:

    - invalid parameter "false", use "off" instead in /etc/nginx/webmail.conf:10
    - to solve this i changed the proxy_redirect value to either off or default, both work

    - host not found in upstream "mail1" in /etc/nginx/webmail.conf:6
    - to solve this i just put in one of my domains that usses webmail, http://webmail.mydomain.com. Not a verry
    good solution to this in my opinion, but i just want to start already.

    - open() "/var/log/nginx/webmail/access.log" failed (2: No such file or directory)
    - created that

    After all that i finnaly get:

    the configuration file /etc/nginx/nginx.conf syntax is ok

    But i do thing I just turned the whole thing off by setting proxy_redirect off;

    When i try to put it back to default it still gives me the same error as before.
     
    Last edited by a moderator: Mar 26, 2010
  8. lvalics

    lvalics Silver Pleskian Plesk Guru

    36
    43%
    Joined:
    Jun 20, 2003
    Messages:
    965
    Likes Received:
    32
    Location:
    Romania
    It was one line not needed in our nginx.conf, the include of webmail, cause we have added that to each domain file.

    The rest should work, especially be sure about the
    proxy_pass http://www.{DOMAIN}:8080$request_uri;

    This is important to be like this, because IF one of your domain is not have the DNS on your server, the start will give to you an error and nginx will not start and also will stay forever to start.

    We have installed so far on 5 servers, on all is working like a charm.

    What we saw is connected to a few programs, where for some reason after the login is done (phpBB; Cerberus Helpdesk so far) will redirect to port 8080. We are working on it to see how can be fixed this.
     
  9. Saif Bechan

    Saif Bechan Guest

    0
     
    Should I just delete the file from the nginx.config file

    Where is this line located, or should i put it in. Should this stay like this or should i fill in the {DOMAIN} with my domain.


    Last question:

    Is it good to change proxy_rewrite_location default; to proxy_rewrite_location off; in the nginx.conf

    When everything works ok i will tell you. The machine i am testing on is:

    Parallels Plesk Panel 9.3 on CentOS 5.4
     
  10. Saif Bechan

    Saif Bechan Guest

    0
     
    Oh yes one thing i saw in one other tutorial. They say Install spawn-fcgi simple program for spawning FastCGI processes.

    Should i do this?
     
  11. lvalics

    lvalics Silver Pleskian Plesk Guru

    36
    43%
    Joined:
    Jun 20, 2003
    Messages:
    965
    Likes Received:
    32
    Location:
    Romania
    On the main config /etc/nginx/nginx.conf there was that additional include, that only delete.

    The rest of the file is JUST to generate the config files with the shell script.
    That files are template files in the zip.

    We do not use FastCGI, we use mod_suphp so I cannot help there.
     
  12. lvalics

    lvalics Silver Pleskian Plesk Guru

    36
    43%
    Joined:
    Jun 20, 2003
    Messages:
    965
    Likes Received:
    32
    Location:
    Romania
    Just a note.
    Seems nginx is not working well with mod_security.
    We investigate this, we hope we will find the way to work.
     
  13. CosminM

    CosminM New Pleskian

    19
    85%
    Joined:
    Sep 24, 2009
    Messages:
    15
    Likes Received:
    0
    Location:
    Bucharest
    Hello,

    I tried the tutorial, all went fine (I commented out the line with include webmail.conf from /etc/nginx/nginx.conf ) but when I try to access a web page on the server it hangs for a while and than is shows a blank page. Tried restarting apache, nginx, no change. Also, no error is generated in /var/log/nginx/error_log
    p.s. on the server there is one domain that had it's nameserveres changed, so it's hosted somewhere else, but I did not received any errors on nginx -t about that.
    Please advice, thank you!
     
  14. Dx3webs

    Dx3webs Basic Pleskian

    20
    23%
    Joined:
    Oct 11, 2010
    Messages:
    78
    Likes Received:
    1
    we run nginx quite happily along side apache on a different ip address

    apache is running mod_php

    will installing fastcgi spawning affect apache in any way?
     
Loading...