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

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,853
Location
GMT +7.00
Hello,

That depends on what could cause it, try

Code:
killall -9 nginx
service nginx start
if it does not help try this then:

Code:
./build update
./build rewrite_confs
if it does not help then make sure you don't have custom templates for nginx/apache, and/or make sure they are not messed.
 

Alex1

Verified User
Joined
Nov 1, 2007
Messages
12
i fix openssl with

/usr/bin/openssl req -x509 -sha256 -newkey rsa:2048 -keyout /etc/httpd/conf/ssl.key/server.key -out /etc/httpd/conf/ssl.crt/server.crt -days 9000 -nodes

/usr/bin/openssl req -x509 -sha256 -newkey rsa:2048 -keyout /etc/nginx/ssl.key/server.key -out /etc/nginx/ssl.crt/server.crt -days 9000 -nodes


after that nginx doesn't restart and give

nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/ssl.key/server.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)

i try also to build nginx_apache again but
 
Last edited:

Alex1

Verified User
Joined
Nov 1, 2007
Messages
12
Try and re-install the server SSL key with cert through Directadmin or manually.
i solved
/usr/bin/openssl req -x509 -sha256 -newkey rsa:4096 -keyout /etc/nginx/ssl.key/server.key -out /etc/nginx/ssl.crt/server.crt -days 9000 -nodes

/usr/bin/openssl req -x509 -sha256 -newkey rsa:4096 -keyout /etc/httpd/conf/ssl.key/server.key -out /etc/httpd/conf/ssl.crt/server.crt -days 9000 -nodes

./build nginx_apache
 
Last edited:

ayberk

Verified User
Joined
Apr 18, 2016
Messages
33
Hi,

After this installation, do i have to make additional settings to improve performance?
 

aminweb

New member
Joined
Sep 3, 2016
Messages
1
whmcs 6 with nginx+apache reverse proxy

I have vps : 4gb ram | 6 processor | web server : nginx+apache mod_php ruid2 with custom build2. I had problem 502 error in my subdomain site (whmcs 6). how to fix this problem?
my.yool.ir
 

anti-ts

Verified User
Joined
Jan 25, 2014
Messages
40
Hi,

a question to clarify:

Are Expire headers in .htaccess working in nginx_apache setups?

I mean blocks like:
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
in .htaccess for example.

Will such headers be honored in final nginx http responses?
 

Strator

Verified User
Joined
Jan 19, 2011
Messages
171
Is my impression correct that Webalizer won't work properly under these conditions? No idea if the overall traffic is correct, but at the very least, it seems like the search engine queries never make it to the final report. Any idea how to fix this - or is there any other method / program to use to get meaningful stats in this kind of setup? Thanks!
 

vahid07

Verified User
Joined
Apr 16, 2018
Messages
7
Drop Google Analitic states after use NGIX as reverse proxy

i have a directadmin cloud server which host my personal sites. i used apache 2.4 as webserver. and few day ago i configed nginx as proxy server which serve static request's . all thing is ok and all thing work correct. but exactly after this change my google analytics and also alexa analytics on my site show lower stats .

after many research on my state i find a amazing result! i can see if anybody come with IOS mobile like iphone, analytic cant count it and it dont show them on realtime section! i compared new states and a day before my changes on server. for many days before 12 april (a day which i configed nginx as reverse proxy) we have near 600 user of IOS devices each day. and on 13, 14 , 15, 16 april it droped to near 10 user!

my users are in site (because google webmaster console and webalizer count them) but according unknown reason google analytics&alexa cant count them in their states.

do you have any idea? is there any nginx mis-configuration?!
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,853
Location
GMT +7.00
@Strator,

With a default configuration of NGINX+Apache all the requests to files, scripts, images, etc hosted on a domain are written into corresponding logs files both in /var/log/nginx/domains/* and /var/log/httpd/domains/*. So there should not be an issue at least by default with either Awstats or Webalizer. At least I've never seen it myself or been reported of any from my customers.
 

Strator

Verified User
Joined
Jan 19, 2011
Messages
171
Thanks for the reply. I knew that there are log files in both location, but I wasn't aware that they are actually identical - thanks for pointing that out.

So then I have a problem with query data being stripped from the referrer - at least in 99% of cases. Just checked - out of 1000+ referrals by Google, Bing etc. I get maybe 10 search strings. In the logs, it appears like the query data is simply missing. Today I have a dozen referrals from Google which just show the domain - there's only one by Bing which does have a search query. Weird.
 

activate

Verified User
Joined
May 30, 2017
Messages
29
Location
Terneuzen, Netherlands
I have latest DA with latest custombuild installed on multiple servers. Two of those servers I have configured to run nginx+apache. This works very well for the websites but I am running into an issue with webmail when trying to reach https://webmail.domain.tld

I followed the instructions for adding webmail to both apache and nginx. However every time I try to access it I get a message (I believe from httpd) :

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Have I made an error in the templates perhaps? The issue is not popping up on https://domain.tld.

Kind regards,

Eelco Bosselaar
 

Strator

Verified User
Joined
Jan 19, 2011
Messages
171
Yesterday i added some custom configurations to nginx, and couldn't restart nginx because of the following error:

nginx: nginx: [emerg] "server_names_hash_bucket_size" directive is duplicate in /etc/nginx/nginx-defaults.conf:18

Now here's the problem: My custom configuration does check if variables are already defined, but it appears that the default configuration doesn't. But in nginx.conf, the custom configurations file (nginx-includes.conf) is loaded BEFORE everything else. In other words, there is no way I can fix this on my end.

Loading the custom configurations first has its merits (especially if you can't redefine variables), but then this only makes sense if there's some kind of check for variables that have already been defined.

Alternatively, nginx-includes.conf should be loaded after everything else - in my mind, that's the second best solution, but at least, it will allow the user to take care of errors. Thanks!
 

labrocca

Verified User
Joined
Mar 12, 2006
Messages
151
@strator Then just put your include line for nginx-includes.conf last in the nginx.conf file. I think that's where I have mine.
 

Strator

Verified User
Joined
Jan 19, 2011
Messages
171
To my knowledge, nginx.conf is maintained by DirectAdmin and could be overwritten automatically - it is therefore not advisable to edit it manually.
 

Strator

Verified User
Joined
Jan 19, 2011
Messages
171
Sounded good, but didn't work unfortunately. I placed a copy of nginx-defaults.conf into custombuild/custom/nginx/conf/, then edited it accordingly and ran:

./build rewrite_confs

from the custombuild directory.

Nginx complained about those same definitions that I had commented out in the custom version of nginx-defaults.conf, and refused to start.
 
Top