Reverse-proxy NGINX + Apache on Directadmin powered server with CB 2.x

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,146
Location
GMT +7.00
Did you remove all the files manually?

And /usr/local/directadmin/data/users/<username>/nginx.conf ?
 

martexx

Verified User
Joined
Jul 30, 2006
Messages
136
Location
Texel the Netherlands
Did you remove all the files manually?

And /usr/local/directadmin/data/users/<username>/nginx.conf ?
Yes i removed those as well, it's more neat, I think custom build should do that as they need to get rewritten anyway when u choose to switch later on, but that's a different discussion.


Perhaps I can rewrite them in some non destructive way?
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
Existing installation on VPS directadmin Centos

Hello,

I have a question. I have not much experience, so maybe my question looks really stupid.

Right now I have a VPS with Centos and directadmin with appr. 25 websites (wordpress & html). Is it possible with custombuild to set NGINX as reverse-proxy by


Code:
cd /usr/local/directadmin/custombuild
./build update
./build update_da
./build set webserver nginx_apache
./build nginx_apache
./build rewrite_confs

Is it possible or do I have to put manual .conf. files in each webdirectory to keep the websites running? Or would it hurt all former installations?

Thanks
 

martexx

Verified User
Joined
Jul 30, 2006
Messages
136
Location
Texel the Netherlands
Hello,

I have a question. I have not much experience, so maybe my question looks really stupid.

Right now I have a VPS with Centos and directadmin with appr. 25 websites (wordpress & html). Is it possible with custombuild to set NGINX as reverse-proxy by


Code:
cd /usr/local/directadmin/custombuild
./build update
./build update_da
./build set webserver nginx_apache
./build nginx_apache
./build rewrite_confs

Is it possible or do I have to put manual .conf. files in each webdirectory to keep the websites running? Or would it hurt all former installations?

Thanks
Hi,

yes that should be posible !! I had some problems but thats properly just me.


If u have problems u can always revert

Code:
cd /usr/local/directadmin/custombuild
./build update
./build update_da
./build set webserver apache
./build apache
./build rewrite_confs
If posible consider going nginx only, thats blazing fast !!!

I run multisite and configuring that with all plugins and nginx was to much for me, but it is really really fast
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
Thank you very much for your answer!!

As I have not much experience, do you mean that when it goes wrong for some reason, with the code you give I go back to the original configuration and there is no chance to loose something (All the websites are online).

Kind Regards
 

martexx

Verified User
Joined
Jul 30, 2006
Messages
136
Location
Texel the Netherlands
Thank you very much for your answer!!

As I have not much experience, do you mean that when it goes wrong for some reason, with the code you give I go back to the original configuration and there is no chance to loose something (All the websites are online).

Kind Regards
Thats what i meant indeed ))

There is always a change of loosing something )) but normally if u cant get nginx-apache to work, that code reverts the changes and u should be fine
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
Wow, it seems to work!! Thank you very much for your time!

All the websites seems fine, but how can I check (is there a command) if it really works as it has to?

When I type my ip the browser says: Nginx is functioning normally

Kind regards,
 

martexx

Verified User
Joined
Jul 30, 2006
Messages
136
Location
Texel the Netherlands
Wow, it seems to work!! Thank you very much for your time!

All the websites seems fine, but how can I check (is there a command) if it really works as it has to?

When I type my ip the browser says: Nginx is functioning normally

Kind regards,
There is no magic command to check that, but u can use (Chrome) "right click on the page>inspect element" and reload the page
In the network tab u can see the requests and also what kind of server replied.

In Firefox u can use Firebug for this
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
wp super cache

Hi,

For my wordpress website I use wp super cache. I just installed NGINX-apache with custombuild as reverse-proxy (before the normal apache with directadmin).

Do I have to change anything to wp super cache (rewrite module:mod_rewrite) or any file?

Kind regards
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
One of the reasons to set nginx as reverse proxu was saving memory for my vps. But when I check the memory httpd (apache) has almost doubled. Is that normal? I thought it would save memory (I have 2 gb memory and almost 750mb is used by apache.

Can anyone explain this for me?
 

pppplus

Verified User
Joined
Dec 19, 2008
Messages
518
Hi

I try to install nginx_apache and all seems to work.
Except at least 2 problems !

1st problem :
I use wildcard subdomains, and for them, .js and .css files are not displayed.
(maybe some other problem

Error in nginx error_log is :
openat() "/var/www/html/themes/style.css" failed (2: No such file or directory), client: 52.25.40.122, server: myserver.fr, request: "GET /themes/style.css HTTP/1.1", host: "wildcard.mydomain.com", referrer: "http://referer.fr/page.php"
this problem occurs also, with relative or complete URL

2nd problem :
Files own by apache are denied


So, if you have a solution, I can reinstall nginx_apache
 

pppplus

Verified User
Joined
Dec 19, 2008
Messages
518
Here an example :

http://wyz.echecs.ovh/

=> there is a problem with the image
(same problem with javascript)

Only the url without subdomain works.


And logs give :
2015/08/18 21:56:21 [error] 29823#0: *1568 openat() "/var/www/html/folder/logo.png" failed (2: No such file or directory), client: 81.48.162.60, server: ns1crea.hb50.fr, request: "GET /folder/logo.png HTTP/1.1", upstream: "http://87.98.217.57:8080/folder/logo.png", host: "wyz.echecs.ovh", referrer: "http://wyz.echecs.ovh/"
2015/08/18 21:56:25 [error] 29823#0: *1574 openat() "/var/www/html/folder/logo.png" failed (2: No such file or directory), client: 81.48.162.60, server: ns1crea.hb50.fr, request: "GET /folder/logo.png HTTP/1.1", upstream: "http://87.98.217.57:8080/folder/logo.png", host: "wyz.echecs.ovh"
2015/08/18 22:20:06 [error] 29819#0: *3045 openat() "/var/www/html/folder/logo.png" failed (2: No such file or directory), client: 81.48.162.60, server: ns1crea.hb50.fr, request: "GET /folder/logo.png HTTP/1.1", upstream: "http://87.98.217.57:8080/folder/logo.png", host: "wyz.echecs.ovh", referrer: "http://wyz.echecs.ovh/"
I can give access to my server, he's no more in production.
 
Last edited:

pppplus

Verified User
Joined
Dec 19, 2008
Messages
518
Hi

No, I don't so I will try, and come back to post !
I've done it for apache, not for nginx.
 

mohammad.983

Verified User
Joined
Jun 26, 2015
Messages
35
Custombuild 2.x: NGINX + Apache

Run this code to build nginx + apache with custombuild:
Code:
cd /usr/local/directadmin/custombuild
./build update
./build update_da
./build set webserver nginx_apache
./build nginx_apache
./build rewrite_confs
That's it. Have fun with it.
Thanks for your helpful guide. I have a question, these steps are enough to config Nginx as reverse proxy for apache?
I mean we don't need to change "php1_mode" or other options?
this is my options.confs, these setting are correct?

Code:
#PHP Settings
php1_release=5.5
php1_mode=mod_php
php2_release=no
php2_mode=php-fpm
opcache=no
htscanner=no
php_ini=no
php_timezone=Asia/Tehran
php_ini_type=production
ioncube=no
zend=no
suhosin=no
x_mail_header=yes
.
.
.
.
#WEB Server Settings
webserver=nginx_apache
litespeed_serialno=trial
modsecurity=no
modsecurity_ruleset=comodo
apache_ver=2.4
apache_mpm=auto
mod_ruid2=yes
harden_symlinks_patch=yes
use_hostname_for_alias=no
redirect_host=server.riranet.com
redirect_host_https=no
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,146
Location
GMT +7.00
Nope, same problem.
If the issue still persists please feel free to contact me for a free 15-minutes limited audit. And I would check it on your server and suggest a solution.



Thanks for your helpful guide. I have a question, these steps are enough to config Nginx as reverse proxy for apache?
I mean we don't need to change "php1_mode" or other options?
this is my options.confs, these setting are correct?



NGINX when running as a reverse proxy with apache as a backend does not care how you run PHP: it does know nothing about PHP versions you use and how many versions you installed. The command in the guide are sufficient in most cases to get nginx+apache running on a linux server.
 
Top