Opalstack has two applications PHP-FPM+NGINX and PHP-Apache for WordPress. . I don’t know much about NGINX.

What will you do to set up your own great overall WordPress? I’m a frontend developer. This is about a backend.

Most people with WordPress have used PHP+Apache for htaccess. I was looking into a rabbit hole about NGINX (pronounce engine-x) PHP-FPM. I have read from DigitalOcean’s Apache vs. NGINX Practical Considerations and Configure Together NGINX and Apache. And from NGINX’s NGINX vs. Apache: Our View of a Decade-Old Question.

Two things I have:

htaccess

  • SetHandler php74-cgi
  • php_flag display_errors off
  • Redirect non-www to www
  • Redirect simply redirects both index.htm and index.html to / for both the root
  • Begin and End WordPress
  • Begin compression and caching
  • Expire headers
  • Cache-Control Headers
  • 6G FIREWALL/BLACKLIST
  • Strong Htaccess Protection
  • AntiSpamBlog Registration
  • Block User ID Phishing Requests
  • Block the scraper bot's name is 'evil scraper' (or whatever)
  • protect against DOS attacks by limiting file upload size
  • Stop spam attack logins and comments
  • Prevent malicious xmlrpc.php directory scanning
  • Personally, for sites at which I am the only author
  • Allow just search engines we like, we're OPT-IN only
  • Let just the good guys in, punt everyone else to the curb
  • Block Blank User Agents
  • Block Logins with empty User-Agent

PHP+Apache (Symbolic Link) for image files.

Can both Apache and NGINX? What will you do?

PS: I just looked at my site now from Webfaction used Firefox Add-ons Web Developer’s View Response Headers and it says server: nginx. I’m shocked that I didn’t know about it. But how does my htaccess work in NGINX?

Thanks, Mikey3D

  • sean replied to this.

    mikey3d our default WP install runs on PHP-CGI+Apache, proxied behind a front-end Nginx server (all apps are proxied like that). That's why you see nginx in your response headers.

    If you'd like us to convert your WP app over to use our PHP-FPM+Nginx stack (with no Apache) then please email support from your registered account email address to let us know the app name and shell user.

    You can mix the PHP-FPM+Nginx app with a symlink app in your site route in the dashboard, we have an example here: Using a symlink app to speed up a WordPress site

      sean Thanks, Sean

      I would like to test myself uploading my local WordPress files to NGINX with your domain links. But I have created a new database and app PHP+Apache (I haven’t tried NGINX app) and changed $table_prefix instead of the default (wp_) in wp-config.php then uploaded it then login DB from adminer and it works. I will figure out how to stop the WP automate creating 5-7 images for one upload image, ridiculous, and among other things for testing first.

      Do a pretty permalink and the functions I have listed above here work in NGINX? What can I do with NGINX?

      Thanks, Mikey3D

      • sean replied to this.

        mikey3d we don't have any configurable options for the PHP-FPM+Nginx other than a couple of performance settings. There's no .htaccess support at all, so if you're relying on .htaccess for all of those features then that probably won't work for you.

        So far most of the WP apps that we've switched over to the new stack work with no changes required, but you still might need to log into your WP dashboard and re-save your permalink settings, clear your caches, etc.

          sean OK, after I log into the WP dashboard and re-save the permalink settings and clear the caches and where does WP automate put rewrite rule in NGINX?

          <IfModule mod_rewrite.c>
          RewriteEngine On
          RewriteBase /
          RewriteRule ^index\.php$ - [L]
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule . /index.php [L]
          </IfModule>

          How to in NGINX, the most important basic to have for the web about redirect links?

          • Redirect non-www to www
          • 301 redirect
          • Redirect simply redirects both index.htm and index.html to / for both the root

          I have read the links above here DigitalOcean and NGINX said you can do one or both together apache and nginx.

          PS: The Opalstack forum color links look like black bold texts. The links standard is blue.

          Thanks, Mikey3D

          • sean replied to this.

            mikey3d you don't need to worry about the rewrite rule, things should work on the Nginx stack without it.

            Redirect non-www to www happens in your WP settings, so there's no need to do that in htaccess either.

              sean How are we able to redirect rules of change 301 permanent redirect links and duplicate contents from no-www to www? I have folder name projects on the root WP folder.

              • sean replied to this.

                mikey3d you might be able to find a WP plugin to do that for you.

                I'm not saying our PHP-FPM+Nginx stack will work for everyone, but it's there if you want to try it out 🙂

                  sean That’s why I’m asking questions about what I can do with NGINX? The people say NGINX is better performance and love to configure it. We all want that. I stay away from most plugins. The plugin I have is a functions plugin that I made instead of putting the codes in my WP template functions file. I like to have control. You know how Google works about ranking. We are always trying to improve and optimize our sites, right Sean? How do we optimize in NGINX? How do you redirect permanently from old or broken or delete links to new URLs in your control without a plugin? 😀

                  • sean replied to this.

                    mikey3d at this time our built-in PHP-FPM+Nginx setup doesn't have any of those options. 🤷‍♂️

                    If you want to build your own PHP+Nginx stack from source and manage all of that yourself like you would do at an unmanaged host like DigitalOcean then you can install a "proxy port" app via your Opalstack dashboard to get a port assignment for it and use that to serve your site.

                    mikey3d DigitalOcean and NGINX said you can do both NGINX and Apache. Why?

                    We're already running Apache behind an Nginx proxy here. That's not the same thing as Nginx serving PHP directly via FPM.

                    Mastodon