Hi team, it's the first time I set up a dedicated machine with Centos 7 and Nginx because I need to host a already 50GB Wordpress page which already has a 2GB database-size alone. (Centos 8's a pain in the ass due to a lot of missing mods) Before this I always went with Ubuntu and Apache. But I didn't regard how cumbersome it is to get a nginx server configured to serve Wordpress permalinks (always getting 404) and rest of the stuff... I read the multiple tutorials here on howtoforge, but I simply cannot get it understood, as the files in my server mostly don't correspond to the files in these tutorials. For setting up the server I exactly followed this tutorial of yours: https://www.howtoforge.com/perfect-server-centos-7-x86_64-nginx-dovecot-ispconfig-3 What I just managed to do is to guess the following ngnix-directives, which I entered in the respective configuration field in the website-management of ISPconfig 3.1. (see screenshot) But I don't even know, if I used the correct location where to put these nginx-directives as most of the nginx-tutorials are recommending to generate individual files in the server-cli. Can you lend me a helping hand? This would be great! Many thanks in advance. All the best, Johannes
I'ts actually quite easy, you just seem to have found the wrong guides Remove everything that you entered in the nginx directives field and then enter just this: Code: location / { try_files $uri $uri/ /index.php?q=$uri$args; }
And for this I spent hours of searching. Ok, thank you, Till. But when I just have you online: There is no more nginx-configuration neccessary for Wordpress than the above snippet? Or is there something else, I need to regard? E.g.: In Nginx there are no .htacess - files. But most of the Caching-Plugins use them. Also WP Fastest Cache, which I was using on this site, as long as it has been on the apache-server. Now I tried to switch to WP-FFPC. This is a working, but unmaintained, plugin, which uses php memcache (or memcached, as you choose). I managed to install it and set define('WP_CACHE',true); in wp-config.php and it seems to work. But is this a solution, you would recommend or is there some better (and faster) solution? Best, Johannes
Basically you can use any WP cache plugin that supports nginx. If the plugin wants to have a specific nginx config, then it will probably write an nginx config file in the web folder. You can then either include it, nginx supports the Include config option to include other files, (less secure) or you copy the content of that plugin specific file and add it in the nginx directives field. The lines I posted is the most basic config that you must use to get URL rewriting. From your original snippet, you can e.g. use the favicon and robots.txt location parts plus the location part for the css/js/etc things, they disable logging fo certain file types and set expire headers.
Ok, thank you Till. Do I need to put everything in the server { } brackets? Because I didn't put your basic lines into these brackets and it still works.
That was the reason why it didn't work before! As you can see, I put my former directives within those server-brackets. Now I know!
But there are 2 little questions remaining, I want to ask you. Then everything's fine. You know that there are "direct-link"-buttons in the ISPconfig-surface for "phpMyAdmin" and "webmailer". As the yum-installer in centos installed the older versions of phpMyAdmin and roundcubemail I needed to replace the phpMy-Admin source files with the latest version of them and I needed to set up roundcubemail in an own sub-domain-hosting. Now the roundcubemail works perfectly also with ssl-certificate, as it is in this sub-domain-hosting, but the link of the webmailer-button in ISPconfig surface points to https://server.myservername.com:8080/mail/webmailer.php?id=3, which, of course, doesn't find the sub-domain-roundcubemail-hosting at https://webmailer.myservername.com And also the phpMyAdmin-buttons link to https://server.myservername.com:8080/sites/database_phpmyadmin.php?id=1 but the phpMyAdmin is found in http://server.myservername.com:8081/phpmyadmin/ (and this URL isn't even protected via ssl). Is there any solution to customize these buttons in the ISPconfig - surface? And how do I set up "https" for the 8081-nginx phpMyAdmin url? If you could give me some hints, I think I have everything I need. Best, Johannes
PS: I didn't know if I should put these 2 final questions in a new thread, because they are covering a slightly different issue. Shall I open a new thread for this?
The buttons are fully configurable under System > interface config. Take care that you enter the full URL there, starting with https://
You can redirect by https to an URL only if that target URL supports https. The apps vhost on port 8081 has no SSL enabled by default, so it does not support https and therefore you can't redirect to it by https. You can either edit that vhost manually, as there re no config options for it, or create a website for a subdomain of one of your domains, with SSL enabled, and use that to access phpmyadmin.
FWIW, checking the installer and templates, it looks like the nginx apps vhost would have ssl enabled right after reconfiguring services with an update, but not subsequently after changing server config (the template used by the nginx server plugin didn't have ssl settings). !1205 should fix that, but I don't have a setup to test it.
Hi Till, after trying around a little bit, there is still some 404 - errors, especially after purging the fastcgi-cache. The 404-errors get better as soon as the cache is built up again, but there is a nasty 404 when I just enter "https://mydomain.com/wp-admin". I tried to add Code: index index.php; to your above snippet in the vhlost-config, but it broke my loginpress-login. Also I have seen a snippet, where a ampersand "&" between "$uri$args;" so it looks like Code: try_files $uri $uri/ /index.php?q=$uri&$args; Is this a correct way of telling nginx, how an URL with paramters look like? or does "try_files $uri $uri/ /index.php?q=$uri$args;" suffice? Also when I call up the "home-page" (meaning like just entering "https://mydomain.com"), after purging the cache the site gets completele broken, because it cannot load the resources and I get a lot of "Failed to load resource: the server responded with a status of 404 (Not Found)" errors for all kinds of css- and js-files. But when I call another page via the menu, which has got a permalink (like "https://mydomain.com/pagename") it works. Intersting thing is, that after some time of calling the site and calling existing permalinks and returning to home-page just via plain-domain it get's working again. But the "https://mydomain.com/wp-admin" still doesn't work. Even when entering the direct "https://leaderclub.network/wp-login.php" I get a 404. Just when I directly call, lets say an "edit"-link, like "https://leaderclub.network/wp-admin/post.php?post=22409&action=edit&lang=de&classic-editor" I get into the backend. This is my vhost-config: And this is the config of the fastcti-bypass variable "$skip_cache variable" which I defined in the global "nginx.conf" so that it is loaded before the "vhost-directives": This is the cache "purge" definition in "nginx.conf" (for purging fastcgi-cache I installed the "Nginx Helper"-plugin and it's working without telling me any errors): And I load the "purge-cache-module" in "nginx.conf" as well as the installed http-image-filter-module (so that the nginx-conf is ok): And for activating the fastcgi-cache I also added these lines to the "nginx.conf" (inside the the "http-bracket," so that they get loaded first of all): The "nginx -t" command produces no error, so everything seems to be ok for nginx. The last thing I have activated in the "wp-config.php" is "define ( 'WP_CACHE', true );". So, in a nutshell, this is everything I "modified". Where may be the error? I urgently need your valued expertise. Best, Johannes