Page 16 of 16 FirstFirst ... 6141516
Results 301 to 312 of 312

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

  1. #301
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    66
    Hi, I have change server conf. to ngix_apache (before apache) and build this conf. Website is runing but when I check loadtime in tools.pingdom I can see that pagesize increase from 2.5 MB to 3.8 MB and load time from 1.99 to 2.40s

    In pagespeed insights I see thaht mod Gzip is not runing but using another tools to test gzip compression I see that gzip is ON
    Last edited by Mattpl; 08-13-2018 at 03:05 PM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | https://szukampracy.pl & https://ksservice.pl & https://pramed.pl

  2. #302
    Join Date
    Jun 2017
    Posts
    16
    Hi,

    For some performance gain i decided to try the nginx_apache setup on one of our servers. Everything looks good and i went form 5 sec. load times to 2sec. load times.

    i do however have a weird issue with some .htaccess rules. Since i mainly have WordPress installations running, we have a .htaccess in the wp-content folder only allowing certain filetypes:

    Code:
    Order deny,allow
    Deny from all
    <Files ~ ".(xml|css|jpe?g|png|gif|js|ttf|otf|eot|pdf|woff|woff2)$">
    	Allow from all
    </Files>
    On apache this would block the use of unknown or unwanted extensions. For some strange reason this does seem to block CSS when running the nginx_apache combination. When rummaging through the error logs i encounter a lot of these:

    [Thu Sep 06 09:12:02.566458 2018] [access_compat:error] [pid 26002:tid 139701260252928] [client aa.bb.cc.dd:0] AH01797: client denied by server configuration: uri /wp-content/plugins/power-builder/framework/assets/js/frontend-builder-global-functions.js,qver=1.0.0.pagespeed.jm.as9jzpvBo3.js, referer: https://dmain.com/
    [Thu Sep 06 09:12:02.593106 2018] [access_compat:error] [pid 26002:tid 139701243467520] [client aa.bb.cc.dd:0] AH01797: client denied by server configuration: uri /wp-content/plugins/tm-header-banner/cherry-framework/modules/cherry-ui-elements/inc/ui-elements/ui-select/assets/select2.js,qver=0.2.9.pagespeed.jm.iVZw-D3mI6.js, referer: https://domain.com/

    Which is weird because the .js is allowed by the .htaccess rule. So, what could cause this weird behavior?

  3. #303
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    66
    someone? I look at /etc/nginx/nginx-gzip.conf

    and gzip is on
    gzip on;
    gzip_static on;
    gzip_disable "msie6";
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/css application/json application/x-javascript text/x$
    gzip_buffers 16 8k;
    but tools like pagespeedinsight etc. shows error about compression - " Turn od gzip compression"

    Testing with Curl
    HTTP/1.1 200 OK
    Server: nginx
    Date: Thu, 13 Sep 2018 13:36:29 GMT
    Connection: keep-alive
    X-Powered-By: PHP/7.0.31
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate
    Pragma: no-cache
    Vary: User-Agent
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    OK I have turn off CWAF and gzip is on
    Last edited by Mattpl; 09-13-2018 at 07:49 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | https://szukampracy.pl & https://ksservice.pl & https://pramed.pl

  4. #304
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    12,482
    @Paarsch,

    I guess pagespeed is the issue, did you try to disable pagespeed for testing?



    @Mattpl,

    Did you try to test with gtmetrix.com? Are those URLs to media files for which GZIP is not enabled are hosted on your server?

    Let us know your real domain name, so that we could check it for you.

  5. #305
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    66
    Quote Originally Posted by zEitEr View Post
    @Paarsch,

    I guess pagespeed is the issue, did you try to disable pagespeed for testing?



    @Mattpl,

    Did you try to test with gtmetrix.com? Are those URLs to media files for which GZIP is not enabled are hosted on your server?

    Let us know your real domain name, so that we could check it for you.
    thanks I have write thaht problem solved I have turn off CWAF and Rules and gzip is on. You could check https://szukampracy.pl

    Now I must try to opt TTFB, but I think thaht I have problem with scripts / mysql because another cms like WP have good TTFB ->http://blog.szukampracy.pl
    Maybe do you have any idea how to check this? I try to use munin but have error after install from ssh root.

    //
    OK I have install yesterday munin and see thaht disk usage is very high, zEitEr Can you look at this stats?
    Last edited by Mattpl; 09-14-2018 at 12:25 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | https://szukampracy.pl & https://ksservice.pl & https://pramed.pl

  6. #306
    Join Date
    Jan 2011
    Posts
    163
    Quote Originally Posted by Strator View Post
    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.
    I revisited this once more and finally got it going. Turns out that I had the path wrong - it is NOT /usr/local/directadmin/custombuild/custom/ but rather /usr/local/directadmin/custombuild/configure/ - also, sind I have nginx set up as a reverse proxy, the full path is:

    /usr/local/directadmin/custombuild/configure/nginx_reverse/conf

    You don't need to move any files there, as they already live in that folder (if they don't, it's the wrong folder). Hope that helps someone.

  7. #307
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    12,482
    You should never modify anything under /usr/local/directadmin/custombuild/configure/, all custom changes should be done only under /usr/local/directadmin/custombuild/custom/, that's the only place where you can copy customized configs and they won't be overwritten by directadmin.

    Directadmin will overwrite all your changes under /usr/local/directadmin/custombuild/configure/ with Directadmin/custombuild update.


    Related:

    - Add custom modules to nginx with custombuild 2.0
    - Adding custom modules to apache for custombuild
    - I wish to customize /etc/httpd/conf/httpd.conf and not have custombuild revert it
    - Using custom configs for PhpMyAdmin, SquirrelMail and Roundcube

  8. #308
    Join Date
    Jan 2011
    Posts
    163
    Quote Originally Posted by zEitEr View Post
    You should never modify anything under /usr/local/directadmin/custombuild/configure/, all custom changes should be done only under /usr/local/directadmin/custombuild/custom/, that's the only place where you can copy customized configs and they won't be overwritten by directadmin.

    Directadmin will overwrite all your changes under /usr/local/directadmin/custombuild/configure/ with Directadmin/custombuild update.


    Related:

    - Add custom modules to nginx with custombuild 2.0
    - Adding custom modules to apache for custombuild
    - I wish to customize /etc/httpd/conf/httpd.conf and not have custombuild revert it
    - Using custom configs for PhpMyAdmin, SquirrelMail and Roundcube
    Thanks for the heads up - now I think I finally understand how this works. So originally my only mistake was that I put the file into /nginx instead of /nginx_reverse. It is now in:

    /usr/local/directadmin/custombuild/custom/nginx_reverse/conf

    and everything works great. Thanks again!

  9. #309
    Join Date
    Aug 2005
    Posts
    109
    Hi everyone,

    I have been very interested in setting up a DA server with Apache+Nginx for quite a while (well before it was integrated in CustomBuild). Now that this available - what type of actual performance gains is everyone seeing? Since moving to Apache + PHP-FPM + Zend OPCache my server has been running great. Am I going to notice a dramatic change in performance by using Nginx?

    My concern is that the performance gains may be offset by the ease of use and maintenance for Apache on its own. Bear in mind I am coming from Apache+Mod_PHP and have been rather slow to change . I host common CMS platforms as well as static HTML websites.

    Thank you for any insight!

  10. #310
    Join Date
    Jan 2011
    Posts
    163
    My insights may not be that useful to you, but I've been using this setup for years and couldn't be happier. Maintenance is easy in my view, the main overhead is that things are a bit different and you do need to get used to that, but once you got used to the new setup, I think it isn't really more complicated. Can't really chime in on the performance gains, however, as the sites I run nowadays don't get that much traffic.

    On the other hand - never change a winning team. If your server is already running great, you don't have much to gain. You'll put it some extra hours, and at the end all you'll get is a server that is still running great.

  11. #311
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    12,482
    Hey, the best way to get an answer is to try it yourself. Install a monitoring system: munin, zabbix, etc and wait a week or two to get enough information on how your server runs with Apache standalone. Then install NGINX in front of your Apache and run them together for a week or two and compare. You might share your results here.

    If you expect to get your sites to work faster.... then NGINX+Apache might not give you any satisfaction here, as they hardly make your sites to work faster if you have heavy PHP scripts with many SQL queries running on every single user hit.

    If you have many users with slow Internet then NGINX+Apache might decrease CPU load and RAM usage. If you have many static files, or use WP with on-disk caching, you might gain a performance improvement with NGINX+Apache.

    Want to cache PHP scripts output with NGINX? You're welcome, but do not cache shopping carts, and pages for authenticated users.

    If you want to stop SPAM-bots from posting to your web-forms, and/or limit concurrent connections per IP, then NGINX in front of Apache might help you significantly.

    I have customers with servers who run NGINX only, NGINX+Apache, NGINX+Varnish+Apache, Apache only, LiteSpeed only servers. And the all cases reserve their own rights to exist.

    And if a server with a single site is running fine with Apache only, we let it go. See the DA forums are running Apache/2, they don't use NGINX.

    But if we have a server with many WP sites, which are brute-forced heavily, then we might install NGINX in front of Apache to add another layer of a protection and to stabilize the server and let the sites to work smoothly. We add much custom code in NGINX templates to reduce impact of attacking bots. If it works in our cases I might assume it will work in your case if you have the same situation... but if you run a video-streaming or gaming server, then it's different.

    What is your use case? Why do you need NGINX?

  12. #312
    Join Date
    Aug 2005
    Posts
    109
    Thank you Strator and zEitEr for your comments, I greatly appreciate it. I can see I will definitely need to spend some time thinking about the benefits and whether they apply to my situation.

    zEitEr your advice is right on the mark as usual . I currently run a mix of WordPress, Drupal and static HTML websites (no streaming/gaming) and am not experiencing any specific issues (e.g. low memory, slow response times etc.). However, I have been very interested in Nginx since I first learned of its capabilities - mainly for my customers benefit.

    I have had several potential customers ask if I provide "WordPress Hosting" like some of the managed providers. I explain that aside from some of the advanced features (staging environment, automation etc.), the DA platform can provide very similar performance. This being the case I am always looking for ways of increasing overall performance. However, from what you have explained I can see that Nginx may or may not be the best for all use cases.

    Your brute-force cutomizations for Nginx sound very intesting. Other than ConfigServer notifications for failed FTP/SMTP authentication attempts, I only receive messages due to excessive memory usage from WP sites. For some customers I have resolved this by disabling WP Cron and setting up a Cron job within DA. However, this isn't possible for everyone. I will definitely keep this in mind and be in touch if I decide to move forward with Nginx.

    I definitely need to follow your advice and do some testing. I have a spare DA license and can spin up a VM to learn more about getting Nginx+Apache configured. This will give me a chance to see how everything works together and to see if it would apply to my situation.

    Thank you both again for your comments and suggestions!

Page 16 of 16 FirstFirst ... 6141516

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •