• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Nginx alongside apache in PLESK 9.3

S

Saif Bechan

Guest
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.
 
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.
 
There is nothing special. Just use vendor's package for nginx installation. Installation should be safe.
 
@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!
 
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:
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.
 
It was one line not needed in our nginx.conf, the include of webmail, cause we have added that to each domain file.

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

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

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
 
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?
 
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.
 
Just a note.
Seems nginx is not working well with mod_security.
We investigate this, we hope we will find the way to work.
 
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!
 
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?
 
Back
Top