kevinjmcmahonjr

  • 10 days ago
  • Joined Jul 28, 2022
  • 1 best answer
  • Main Question:
    From the starting point of a site being installed with the --wpredis flag but Redis not enabled in the Redis plugin, what would be the best way to either disable all caching or edit the make sure URLs or URL forwards/rewrites are not cached?

    Back Story:
    I have an WooCommerce store that has a ton of weird and crazy customizations to it for a very specific use case. This includes URL rewrites and in some cases if a URL doesn't match certain criteria it just dumps the user to the home page. I think at times this is getting cached and so if this happens in one of the categories that entire category ends up just getting forwarded to the home page. If I purge the entire cache from Ngnix helper, the issue goes away.

    So far it hasn't been too often, but it does happen and with ecommerce you know how people are if it doesn't work they just bounce. This is a very special type of store so I'm not overly concerned about click through rates and such, but it should still just work all of the time.

    I know this is not conventional, it's not ideal. There were specific requirements for this store that ended up resulting in these goofy URL rewrites.

    Thanks,

  • I redesigned and took over a site, the old site used a really old CMS, and all its URLs ended in .php so now I'm getting lots of indexing issues with search engines since Nginx is configured to 404 anything that ends in .php and not index.php. I get the nginx 404 not the WordPress 404 since nginx is just blocking direct access to a php file.

    Are there any issues with just adding a rewrite rule in the nginx config to just simply remove the .php from the URL and then letting WordPress handle it from there?

    Example of what I want to add:

    location ~ ^/(?!index\.php$)(.+)\.php($|/) {
            rewrite ^/(?!index\.php$)(.+)\.php$ /$1 permanent;
        }

    I plan to put it in the site's nginx config that WordOps provides after the index but before any includes.

    Thanks

    • I could swear I checked the docs and it said it was compatible with 24.04 LTS now so I gave it a whirl but the WordOps status was KO and this was the only error that showed:

      wo: line 927: wo: command not found

      I tried the install script again, same error, I wiped the instance and started fresh same thing, I wiped the instance again but used 22.04 LTS instead and it worked so I moved on and just going to use 22.04 LTS. I have no bleeding edge need to use 24 over 22 I just figured it's a few months old now should be mature enough to start using it and stay on the latest. I'm not worried about it and I don't have time to go back and forth on it. Just figured I'd let you all know.

    • I noticed that when I use the WordOps command:
      wo log show site.tld --php
      it does not show me the same log that is found in the /var/log/php(version)-fpm.log so my question is what specific log file is the wo command showing?

    • I have a video that should auto-play and loop. It works everywhere except for on iPads and iPhones... The backup image loads in so it's not the end of the world but from what I gather some server settings may help which is why I'm asking about it here. Someone reported this adjustment to compression in Apache config involving gzip and fixed it for them:

      SetOutputFilter DEFLATE
      SetEnvIfNoCase Request_URI .(mp4|ogv|webm)$ no-gzip dont-vary

      Obviously that's Apache so I need to know how to properly add the equivelent into nginx, also I believe WordOps uses Brotli so I'm not sure if that will make some difference in how to make the adjustment.

      I can go to Nginx documentaion and find the gzip options there and apply that to a server config, but I want to make sure whatever I do is the intended method or compatible method for WordOps and its configs.

      Thanks

      • Main Question:
        If I put up a basic HTML site and then add Basic Auth, will there be rate-limiting and monitored by Fail2Ban? Are the passwords just saved in plain text?

        Backstory:
        I have a dashboard that has no login/authentication. It's for Shlink, a self-hosted URL shortener the back end is secure, but the front end is a PWA you can use anywhere but if you want it on a neat domain you need to host it somewhere.

        I already have the backend up and running, used WordOps to make a MySQL site with PHP8.2. Minor adjustments to the nginx conf for the site. Installed and working. I figured for ease of access I just wanted to put the optional front end on an admin.domain.tld type of thing, but it needs to be access-restricted.

      • marty it is just 2GB but also it's just two brochure websites and it was on off peak hours.

      • I have a server that went down last night, NGINX appeared to just have stopped running. I'm just trying figure out why so I can make sure it doesn't happen again. Google did not really help, just others with the same issue with no solutions. Server ran fine for month but a few days ago I did update WordOps and I did add a new WordPress website too it. Nothing crazy on the site just a brochure kind of setup.

        A reboot got it back up, before the reboot I check the error logs in /var/log/nginx/error.log and this is the only thing in there that seems to coorelate to the

        2023/01/26 20:50:16 [alert] 10892#10892: worker process 10996 exited on signal 9

        But Googling did not provide me with much more context.

        Thanks

      • I tried search the GitHub repo for "--ngxblocker" so I could just get a better understanding of this myself but it returned no results.

        So I came across the --ngxblocker in the documentation, but there's not much else mentioned aside from to disable and enable it. I'm assuming it installs the Ultimate Nginx Bad Bots Blocker by Mitchell Krog, but it doesn't explicitly say that. I'm honestly not that familiar with this and wanted to know if others are using this feature a lot and confirm that it is indeed the same "blocker" for Ngnix.

        You can also run an wo stack upgrade --ngxblocker to update a block list, should this just be put on a cron job? Does it auto-update on its own but this stack upgrade is to force an update?

        Most other features in WordOps I've had the pleasure and burden of implementing myself at some point of another so WordOps has been such a time saver and over all headache reducer for me.

        I am looking into adding some WAF features. I'm familiar with 7G by Jeff Star and his WordPress plugin variants, I'm not familiar with this Ngnix Blocker though. Also anyone implement CrowdSec with WordOps?

        • I have tried removing the default Nginx site and also simply modifying it to drop any request without a server name but the results are the same. It seems the forward from 80 to 443 kicks in first and then defaults to forwarding to the first website on the server.... Not what I want to happen I just want it to drop the connection whether it's on 80 or 443. Is there a WordOps method for doing this? If not, what's the best Nginx method for doing so? If I put anything in the default to listen on 443 I get Nginx errors because there's no certificate, even though it would be ideal for this to drop before that even happens.

          The best solution I've come up with is adding the following if statement to the first site... but it feels a bit clunky and something I'll have to always remember to do.

          if ( $http_host !~* example.com|www.example.com$ ) {
          return 444;
          }

          Thanks!

        • Still no clue how things go messed up in the first place, but I ended up realizing WordOps has a whole set of stack commands so I purged all the PHP using 'wo stack purge --php74' and 'wo stack purge --php80' commands then installed PHP again with 'wo stack install --php74' and then did a stack restart 'wo stack restart' and bam it has fixed itself...

        • I just did a fresh install of WordOps, it appeared to only come with PHP 8 so afterwards I manually installed php7.4 with all the extensions I will be needing from apt. Before I created any site, the domains pointing the server did display the nginx welcome page.

          Then I created two sites, one will not be a WordPress site so I used the command "wo site create site1.tld --php74 --mysql -hsts". Then I created a new WordPress site using "wo site create site2.tld --php74 --wpredis --hsts" and if I try to access it I simply get a 503 error. If I throw a test index.html in the first site I do get the file served, but if I put a test php file I have the same issue as the WordPress site.

          I've restarted nginx, php7.4-fpm and mysql/mariadb many times through out debugging.

          I checked the nginx logs and it shows that it cannot access the php7.4-two-fpm.sock so I checked out the /var/run/php location and there is a php7.4-fpm.sock but there is not a php7.4-two-fpm.sock in there... I tried to find in the nginx config files where the fastcgi_pass unix would be to simply try and change this to the sock that actually exists, but I cannot find a reference at all. I used grep to search the nginx directory for 'fastcgi_pass unix' and only found the line in the default nginx site file that is commented out anyway and searching for 'php7.4-two-fpm' found nothing.

          Also the in /etc/php/7.4/fpm/pool.d/www.conf is configure for listen = /var/run/php/php7.4-fpm.sock no 'two' there, so I have no idea why the error logs say it's looking for php7.4-two-fpm.sock

          The nginx error is:
          [crit] 1369#1369: *105 connect() to unix:/var/run/php/php74-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: myserver.tld, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php74-fpm.sock:", host: "myserver"

          [error] 1369#1369: *105 no live upstreams while connecting to upstream, client: 74.105.113.21, server: myserver.tld, request: "GET / HTTP/2.0", upstream: "fastcgi://php74", host: "myserver.tld"

          So I need to either understand how WordOps has modified the nginx config so I can point it to the correct sock, or I need to figure out how to create the missing php7.4-two-fpm.sock, bonus points if someone can also help me understand why this even happened. I could just start over at this point, there isn't anything on this server, but it seems to be almost working and I'm more curious why it isn't and how to fix it as this is not the first time I used WordOps and it worked great for me before.

          Thanks

          • Still no clue how things go messed up in the first place, but I ended up realizing WordOps has a whole set of stack commands so I purged all the PHP using 'wo stack purge --php74' and 'wo stack purge --php80' commands then installed PHP again with 'wo stack install --php74' and then did a stack restart 'wo stack restart' and bam it has fixed itself...

        Hosted by VirtuBox