Wordpress and NGINX [Slightly OT]

Mark Haney mark.haney at vifprogram.com
Thu Mar 10 17:03:45 UTC 2016


Well, in this case, we'd migrated off onto a new Linux VM with Nginx and
WordPress.  Everything is clean and no legacy stuff was carried over.  But,
in order to make a clean break of things, I needed a solution that would
keep me from a) either copying those legacy PHP files over to the new
server, b) creating similar PHP files with html/php redirects to the WP
pages, or c) leaving them as nginx 404s.


On Thu, Mar 10, 2016 at 11:39 AM, fred roller <fredroller66 at gmail.com>
wrote:

> Also, people like change and seeing companies grow. See if your marketing
> can put a spin in that direction about growing which would allow you to
> slowly migrate everything over to what you need there by working the creep
> out of the website that you are on.
>
> I apologize for the top post I am writing this from my phone.
>
> Fred Roller
> On Mar 10, 2016 8:58 AM, "Mark Haney" <mark.haney at vifprogram.com> wrote:
>
>> That's pretty close to the solution I came up with. I'm really kind of
>> shocked that there wasn't a clear cut example configuration on how to
>> handle this particular issue.  Though, I'm willing to bet very few people
>> have dealt with the chaos that is this old site.  It being a mixture of
>> Joomla and standalone PHP files has been a thorn in my side since I
>> inherited the thing 2 years ago.  A custom WP 404 page was already in
>> place, and our Marketing department was insistent on using it instead of a
>> standalone copy of that same page, mainly because they were dead set on not
>> having missing standalone PHP page redirect to that custom 404 page, but
>> redirect to particular pages *inside wordpress*.  This left me with a
>> lot fewer options, but the one I came up with seems to work perfectly.
>>
>> The new 'working' config I included if anyone is interested, but the way
>> I found to cover all my bases is to have the @wordpress location just call
>> the WP index.php file if all else fails.  In our case there's a WP
>> component that handles redirects for those missing .php files, some of
>> which go to the custom 404 page, some to blog entries.  It seems pretty
>> simple in hindsight, but I wasn't sure that would even work properly.
>> Granted, this is probably a very uncommon problem, but this does appear to
>> work, and even better than I expected.  All I was hoping for was to get
>> everything that failed to the Custom 404 page.
>>
>> I will say, the more I've worked with nginx, the better I like it.
>>
>>
>> On Wed, Mar 9, 2016 at 3:08 PM, Rick Stevens <ricks at alldigital.com>
>> wrote:
>>
>>> On 03/09/2016 11:20 AM, Mark Haney wrote:
>>>
>>>> I hope someone can give me an idea on how to get this setup. I'm no WP
>>>> expert (never having setup it up prior to a few weeks ago), but this
>>>> issue I'd like to find a way to make work.
>>>>
>>>> As I said, we have WP running on an NGINX server which is replacing an
>>>> old Joomla server.  The issue has to do with the fact there were several
>>>> static PHP pages built over the years on the Joomla server that we don't
>>>> want to move manually to the WP server.
>>>>
>>>> The problem is that our Marketing used a lot of these standalone .php
>>>> files in ads and such and want those urls to work by redirecting either
>>>> to the home page or to specific pages inside WP.  (The latter is not a
>>>> must have.)
>>>>
>>>> The problem is that I can't figure out a way to have NGINX test for a
>>>> particular .php file and if it's not there, redirect to (or display) a
>>>> 404 page inside wordpress.  In every case, when NGINX tries to find that
>>>> .php file it throws up the NGINX 404 page.
>>>>
>>>> I can build a custom 404 page, but Marketing wants to use the page
>>>> inside WP.  There are several configs floating around that appear to
>>>> solve the problem, but none of them work for me.  I've been told this is
>>>> possible, but I've not found the answer if its out there.  Someone got
>>>> any ideas?
>>>>
>>>> I've attached my config file if that will help.
>>>>
>>>
>>> I'm sure you've tried this, but inside your "server {" section, add
>>>
>>>         error_page 404 /page/you/want/to/display/on/404/error;
>>>
>>> before your first "location" directive. Theoretically, the "/" should
>>> go through your "location /" section and do a try_files on
>>> "/page/you/want/to/display/on/404/error" via the @wordpress stuff.
>>>
>>> Ideally you do:
>>>
>>>         error_page 404 /custom_404.html
>>>
>>> and a
>>>
>>>         location /custom_404.html {
>>>                 root /path/to/your/wordpress/404/error/doc/root;
>>>                 internal;
>>>         }
>>>
>>> That way you absolutely define the directory that contains the
>>> "custom_404.html" file, and the "internal" directive means that
>>> location is only available to nginx's internal operations (it can't
>>> be browsed).
>>> ----------------------------------------------------------------------
>>> - Rick Stevens, Systems Engineer, AllDigital    ricks at alldigital.com -
>>> - AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
>>> -                                                                    -
>>> -             To iterate is human, to recurse, divine.               -
>>> ----------------------------------------------------------------------
>>> --
>>> users mailing list
>>> users at lists.fedoraproject.org
>>> To unsubscribe or change subscription options:
>>> https://admin.fedoraproject.org/mailman/listinfo/users
>>> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
>>> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>>> Have a question? Ask away: http://ask.fedoraproject.org
>>>
>>
>>
>>
>> --
>>
>> Mark Haney ::: Senior Systems Engineer
>> *VIF* International Education
>> P.O. Box 3566 ::: Chapel Hill, N.C. 27515 ::: USA
>> 919-265-5006 office
>>
>> Global learning for all.
>> www.vifprogram.com
>> <http://www.vifprogram.com/?utm_source=signature&utm_medium=email&utm_campaign=VIF>
>> Find VIF on Facebook <http://facebook.com/VIFInternationalEducation> |
>> Twitter <https://twitter.com/vifglobaled> | LinkedIn
>> <http://www.linkedin.com/company/vif-international-education>
>>
>> Recognized as a ‘Best for the World’
>> <http://bestfortheworld.bcorporation.net/> B Corp!
>>
>> --
>> users mailing list
>> users at lists.fedoraproject.org
>> To unsubscribe or change subscription options:
>> https://admin.fedoraproject.org/mailman/listinfo/users
>> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
>> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>> Have a question? Ask away: http://ask.fedoraproject.org
>>
>>
> --
> users mailing list
> users at lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
> Have a question? Ask away: http://ask.fedoraproject.org
>
>


-- 

Mark Haney ::: Senior Systems Engineer
*VIF* International Education
P.O. Box 3566 ::: Chapel Hill, N.C. 27515 ::: USA
919-265-5006 office

Global learning for all.
www.vifprogram.com
<http://www.vifprogram.com/?utm_source=signature&utm_medium=email&utm_campaign=VIF>
Find VIF on Facebook <http://facebook.com/VIFInternationalEducation> |
Twitter <https://twitter.com/vifglobaled> | LinkedIn
<http://www.linkedin.com/company/vif-international-education>

Recognized as a ‘Best for the World’
<http://bestfortheworld.bcorporation.net/> B Corp!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20160310/a19ec060/attachment-0001.html>


More information about the users mailing list